chiark / gitweb /
Merge from MDW's branch:
[disorder] / server / speaker.c
1 /*
2  * This file is part of DisOrder
3  * Copyright (C) 2005, 2006, 2007 Richard Kettlewell
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA
19  */
20
21 /* This program deliberately does not use the garbage collector even though it
22  * might be convenient to do so.  This is for two reasons.  Firstly some libao
23  * drivers are implemented using threads and we do not want to have to deal
24  * with potential interactions between threading and garbage collection.
25  * Secondly this process needs to be able to respond quickly and this is not
26  * compatible with the collector hanging the program even relatively
27  * briefly. */
28
29 #include <config.h>
30 #include "types.h"
31
32 #include <getopt.h>
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <locale.h>
36 #include <syslog.h>
37 #include <unistd.h>
38 #include <errno.h>
39 #include <ao/ao.h>
40 #include <string.h>
41 #include <assert.h>
42 #include <sys/select.h>
43 #include <time.h>
44
45 #include "configuration.h"
46 #include "syscalls.h"
47 #include "log.h"
48 #include "defs.h"
49 #include "mem.h"
50 #include "speaker.h"
51 #include "user.h"
52
53 #if BUILD_SPEAKER
54 #include <alsa/asoundlib.h>
55
56 #define BUFFER_SECONDS 5                /* How many seconds of input to
57                                          * buffer. */
58
59 #define FRAMES 4096                     /* Frame batch size */
60
61 #define NFDS 256                        /* Max FDs to poll for */
62
63 /* Known tracks are kept in a linked list.  We don't normally to have
64  * more than two - maybe three at the outside. */
65 static struct track {
66   struct track *next;                   /* next track */
67   int fd;                               /* input FD */
68   char id[24];                          /* ID */
69   size_t start, used;                   /* start + bytes used */
70   int eof;                              /* input is at EOF */
71   int got_format;                       /* got format yet? */
72   ao_sample_format format;              /* sample format */
73   unsigned long long played;            /* number of frames played */
74   char *buffer;                         /* sample buffer */
75   size_t size;                          /* sample buffer size */
76   int slot;                             /* poll array slot */
77 } *tracks, *playing;                    /* all tracks + playing track */
78
79 static time_t last_report;              /* when we last reported */
80 static int paused;                      /* pause status */
81 static snd_pcm_t *pcm;                  /* current pcm handle */
82 static ao_sample_format pcm_format;     /* current format if aodev != 0 */
83 static size_t bpf;                      /* bytes per frame */
84 static struct pollfd fds[NFDS];         /* if we need more than that */
85 static int fdno;                        /* fd number */
86 static snd_pcm_uframes_t pcm_bufsize;   /* buffer size */
87 static snd_pcm_uframes_t last_pcm_bufsize; /* last seen buffer size */
88 static int forceplay;                   /* frames to force play */
89
90 static const struct option options[] = {
91   { "help", no_argument, 0, 'h' },
92   { "version", no_argument, 0, 'V' },
93   { "config", required_argument, 0, 'c' },
94   { "debug", no_argument, 0, 'd' },
95   { "no-debug", no_argument, 0, 'D' },
96   { 0, 0, 0, 0 }
97 };
98
99 /* Display usage message and terminate. */
100 static void help(void) {
101   xprintf("Usage:\n"
102           "  disorder-speaker [OPTIONS]\n"
103           "Options:\n"
104           "  --help, -h              Display usage message\n"
105           "  --version, -V           Display version number\n"
106           "  --config PATH, -c PATH  Set configuration file\n"
107           "  --debug, -d             Turn on debugging\n"
108           "\n"
109           "Speaker process for DisOrder.  Not intended to be run\n"
110           "directly.\n");
111   xfclose(stdout);
112   exit(0);
113 }
114
115 /* Display version number and terminate. */
116 static void version(void) {
117   xprintf("disorder-speaker version %s\n", disorder_version_string);
118   xfclose(stdout);
119   exit(0);
120 }
121
122 /* Return the number of bytes per frame in FORMAT. */
123 static size_t bytes_per_frame(const ao_sample_format *format) {
124   return format->channels * format->bits / 8;
125 }
126
127 /* Find track ID, maybe creating it if not found. */
128 static struct track *findtrack(const char *id, int create) {
129   struct track *t;
130
131   D(("findtrack %s %d", id, create));
132   for(t = tracks; t && strcmp(id, t->id); t = t->next)
133     ;
134   if(!t && create) {
135     t = xmalloc(sizeof *t);
136     t->next = tracks;
137     strcpy(t->id, id);
138     t->fd = -1;
139     tracks = t;
140     /* The initial input buffer will be the sample format. */
141     t->buffer = (void *)&t->format;
142     t->size = sizeof t->format;
143   }
144   return t;
145 }
146
147 /* Remove track ID (but do not destroy it). */
148 static struct track *removetrack(const char *id) {
149   struct track *t, **tt;
150
151   D(("removetrack %s", id));
152   for(tt = &tracks; (t = *tt) && strcmp(id, t->id); tt = &t->next)
153     ;
154   if(t)
155     *tt = t->next;
156   return t;
157 }
158
159 /* Destroy a track. */
160 static void destroy(struct track *t) {
161   D(("destroy %s", t->id));
162   if(t->fd != -1) xclose(t->fd);
163   if(t->buffer != (void *)&t->format) free(t->buffer);
164   free(t);
165 }
166
167 /* Notice a new FD. */
168 static void acquire(struct track *t, int fd) {
169   D(("acquire %s %d", t->id, fd));
170   if(t->fd != -1)
171     xclose(t->fd);
172   t->fd = fd;
173   nonblock(fd);
174 }
175
176 /* Read data into a sample buffer.  Return 0 on success, -1 on EOF. */
177 static int fill(struct track *t) {
178   size_t where, left;
179   int n;
180
181   D(("fill %s: eof=%d used=%zu size=%zu  got_format=%d",
182      t->id, t->eof, t->used, t->size, t->got_format));
183   if(t->eof) return -1;
184   if(t->used < t->size) {
185     /* there is room left in the buffer */
186     where = (t->start + t->used) % t->size;
187     if(t->got_format) {
188       /* We are reading audio data, get as much as we can */
189       if(where >= t->start) left = t->size - where;
190       else left = t->start - where;
191     } else
192       /* We are still waiting for the format, only get that */
193       left = sizeof (ao_sample_format) - t->used;
194     do {
195       n = read(t->fd, t->buffer + where, left);
196     } while(n < 0 && errno == EINTR);
197     if(n < 0) {
198       if(errno != EAGAIN) fatal(errno, "error reading sample stream");
199       return 0;
200     }
201     if(n == 0) {
202       D(("fill %s: eof detected", t->id));
203       t->eof = 1;
204       return -1;
205     }
206     t->used += n;
207     if(!t->got_format && t->used >= sizeof (ao_sample_format)) {
208       assert(t->used == sizeof (ao_sample_format));
209       /* Check that our assumptions are met. */
210       if(t->format.bits & 7)
211         fatal(0, "bits per sample not a multiple of 8");
212       /* Make a new buffer for audio data. */
213       t->size = bytes_per_frame(&t->format) * t->format.rate * BUFFER_SECONDS;
214       t->buffer = xmalloc(t->size);
215       t->used = 0;
216       t->got_format = 1;
217       D(("got format for %s", t->id));
218     }
219   }
220   return 0;
221 }
222
223 /* Return true if A and B denote identical libao formats, else false. */
224 static int formats_equal(const ao_sample_format *a,
225                          const ao_sample_format *b) {
226   return (a->bits == b->bits
227           && a->rate == b->rate
228           && a->channels == b->channels
229           && a->byte_format == b->byte_format);
230 }
231
232 /* Close the sound device. */
233 static void idle(void) {
234   int  err;
235
236   D(("idle"));
237   if(pcm) {
238     if((err = snd_pcm_nonblock(pcm, 0)) < 0)
239       fatal(0, "error calling snd_pcm_nonblock: %d", err);
240     D(("draining pcm"));
241     snd_pcm_drain(pcm);
242     D(("closing pcm"));
243     snd_pcm_close(pcm);
244     pcm = 0;
245     forceplay = 0;
246     D(("released audio device"));
247   }
248 }
249
250 /* Abandon the current track */
251 static void abandon(void) {
252   struct speaker_message sm;
253
254   D(("abandon"));
255   memset(&sm, 0, sizeof sm);
256   sm.type = SM_FINISHED;
257   strcpy(sm.id, playing->id);
258   speaker_send(1, &sm, 0);
259   removetrack(playing->id);
260   destroy(playing);
261   playing = 0;
262   forceplay = 0;
263 }
264
265 static void log_params(snd_pcm_hw_params_t *hwparams,
266                        snd_pcm_sw_params_t *swparams) {
267   snd_pcm_uframes_t f;
268   unsigned u;
269
270   return;                               /* too verbose */
271   if(hwparams) {
272     /* TODO */
273   }
274   if(swparams) {
275     snd_pcm_sw_params_get_silence_size(swparams, &f);
276     info("sw silence_size=%lu", (unsigned long)f);
277     snd_pcm_sw_params_get_silence_threshold(swparams, &f);
278     info("sw silence_threshold=%lu", (unsigned long)f);
279     snd_pcm_sw_params_get_sleep_min(swparams, &u);
280     info("sw sleep_min=%lu", (unsigned long)u);
281     snd_pcm_sw_params_get_start_threshold(swparams, &f);
282     info("sw start_threshold=%lu", (unsigned long)f);
283     snd_pcm_sw_params_get_stop_threshold(swparams, &f);
284     info("sw stop_threshold=%lu", (unsigned long)f);
285     snd_pcm_sw_params_get_xfer_align(swparams, &f);
286     info("sw xfer_align=%lu", (unsigned long)f);
287   }
288 }
289
290 /* Make sure the sound device is open and has the right sample format.  Return
291  * 0 on success and -1 on error. */
292 static int activate(void) {
293   int err;
294   snd_pcm_hw_params_t *hwparams;
295   snd_pcm_sw_params_t *swparams;
296   int sample_format = 0;
297   unsigned rate;
298
299   /* If we don't know the format yet we cannot start. */
300   if(!playing->got_format) {
301     D((" - not got format for %s", playing->id));
302     return -1;
303   }
304   /* If we need to change format then close the current device. */
305   if(pcm && !formats_equal(&playing->format, &pcm_format))
306      idle();
307   if(!pcm) {
308     D(("snd_pcm_open"));
309     if((err = snd_pcm_open(&pcm,
310                            config->device,
311                            SND_PCM_STREAM_PLAYBACK,
312                            SND_PCM_NONBLOCK))) {
313       error(0, "error from snd_pcm_open: %d", err);
314       goto error;
315     }
316     snd_pcm_hw_params_alloca(&hwparams);
317     D(("set up hw params"));
318     if((err = snd_pcm_hw_params_any(pcm, hwparams)) < 0)
319       fatal(0, "error from snd_pcm_hw_params_any: %d", err);
320     if((err = snd_pcm_hw_params_set_access(pcm, hwparams,
321                                            SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
322       fatal(0, "error from snd_pcm_hw_params_set_access: %d", err);
323     switch(playing->format.bits) {
324     case 8:
325       sample_format = SND_PCM_FORMAT_S8;
326       break;
327     case 16:
328       switch(playing->format.byte_format) {
329       case AO_FMT_NATIVE: sample_format = SND_PCM_FORMAT_S16; break;
330       case AO_FMT_LITTLE: sample_format = SND_PCM_FORMAT_S16_LE; break;
331       case AO_FMT_BIG: sample_format = SND_PCM_FORMAT_S16_BE; break;
332         error(0, "unrecognized byte format %d", playing->format.byte_format);
333         goto fatal;
334       }
335       break;
336     default:
337       error(0, "unsupported sample size %d", playing->format.bits);
338       goto fatal;
339     }
340     if((err = snd_pcm_hw_params_set_format(pcm, hwparams,
341                                            sample_format)) < 0) {
342       error(0, "error from snd_pcm_hw_params_set_format (%d): %d",
343             sample_format, err);
344       goto fatal;
345     }
346     rate = playing->format.rate;
347     if((err = snd_pcm_hw_params_set_rate_near(pcm, hwparams, &rate, 0)) < 0) {
348       error(0, "error from snd_pcm_hw_params_set_rate (%d): %d",
349             playing->format.rate, err);
350       goto fatal;
351     }
352     if(rate != (unsigned)playing->format.rate)
353       info("want rate %d, got %u", playing->format.rate, rate);
354     if((err = snd_pcm_hw_params_set_channels(pcm, hwparams,
355                                              playing->format.channels)) < 0) {
356       error(0, "error from snd_pcm_hw_params_set_channels (%d): %d",
357             playing->format.channels, err);
358       goto fatal;
359     }
360     pcm_bufsize = 3 * FRAMES;
361     if((err = snd_pcm_hw_params_set_buffer_size_near(pcm, hwparams,
362                                                      &pcm_bufsize)) < 0)
363       fatal(0, "error from snd_pcm_hw_params_set_buffer_size (%d): %d",
364             3 * FRAMES, err);
365     if(pcm_bufsize != 3 * FRAMES && pcm_bufsize != last_pcm_bufsize)
366       info("asked for PCM buffer of %d frames, got %d",
367            3 * FRAMES, (int)pcm_bufsize);
368     last_pcm_bufsize = pcm_bufsize;
369     if((err = snd_pcm_hw_params(pcm, hwparams)) < 0)
370       fatal(0, "error calling snd_pcm_hw_params: %d", err);
371     D(("set up sw params"));
372     snd_pcm_sw_params_alloca(&swparams);
373     if((err = snd_pcm_sw_params_current(pcm, swparams)) < 0)
374       fatal(0, "error calling snd_pcm_sw_params_current: %d", err);
375     if((err = snd_pcm_sw_params_set_avail_min(pcm, swparams, FRAMES)) < 0)
376       fatal(0, "error calling snd_pcm_sw_params_set_avail_min %d: %d",
377             FRAMES, err);
378     if((err = snd_pcm_sw_params(pcm, swparams)) < 0)
379       fatal(0, "error calling snd_pcm_sw_params: %d", err);
380     pcm_format = playing->format;
381     bpf = bytes_per_frame(&pcm_format);
382     D(("acquired audio device"));
383     log_params(hwparams, swparams);
384   }
385   return 0;
386 fatal:
387   abandon();
388 error:
389   /* We assume the error is temporary and that we'll retry in a bit. */
390   if(pcm) {
391     snd_pcm_close(pcm);
392     pcm = 0;
393   }
394   return -1;
395 }
396
397 /* Check to see whether the current track has finished playing */
398 static void maybe_finished(void) {
399   if(playing
400      && playing->eof
401      && (!playing->got_format
402          || playing->used < bytes_per_frame(&playing->format)))
403     abandon();
404 }
405
406 static void play(size_t frames) {
407   snd_pcm_sframes_t written_frames;
408   size_t avail_bytes, avail_frames, written_bytes;
409   int err;
410
411   if(activate()) {
412     if(playing)
413       forceplay = frames;
414     else
415       forceplay = 0;                    /* Must have called abandon() */
416     return;
417   }
418   D(("play: play %zu/%zu%s %dHz %db %dc",  frames, playing->used / bpf,
419      playing->eof ? " EOF" : "",
420      playing->format.rate,
421      playing->format.bits,
422      playing->format.channels));
423   /* If we haven't got enough bytes yet wait until we have.  Exception: when
424    * we are at eof. */
425   if(playing->used < frames * bpf && !playing->eof) {
426     forceplay = frames;
427     return;
428   }
429   /* We have got enough data so don't force play again */
430   forceplay = 0;
431   /* Figure out how many frames there are available to write */
432   if(playing->start + playing->used > playing->size)
433     avail_bytes = playing->size - playing->start;
434   else
435     avail_bytes = playing->used;
436   avail_frames = avail_bytes / bpf;
437   if(avail_frames > frames)
438     avail_frames = frames;
439   if(!avail_frames)
440     return;
441   written_frames = snd_pcm_writei(pcm,
442                                   playing->buffer + playing->start,
443                                   avail_frames);
444   D(("actually play %zu frames, wrote %d",
445      avail_frames, (int)written_frames));
446   if(written_frames < 0) {
447     switch(written_frames) {
448     case -EPIPE:                        /* underrun */
449       error(0, "snd_pcm_writei reports underrun");
450       if((err = snd_pcm_prepare(pcm)) < 0)
451         fatal(0, "error calling snd_pcm_prepare: %d", err);
452       return;
453     case -EAGAIN:
454       return;
455     default:
456       fatal(0, "error calling snd_pcm_writei: %d", (int)written_frames);
457     }
458   }
459   written_bytes = written_frames * bpf;
460   playing->start += written_bytes;
461   playing->used -= written_bytes;
462   playing->played += written_frames;
463   /* If the pointer is at the end of the buffer (or the buffer is completely
464    * empty) wrap it back to the start. */
465   if(!playing->used || playing->start == playing->size)
466     playing->start = 0;
467   frames -= written_frames;
468 }
469
470 /* Notify the server what we're up to. */
471 static void report(void) {
472   struct speaker_message sm;
473
474   if(playing && playing->buffer != (void *)&playing->format) {
475     memset(&sm, 0, sizeof sm);
476     sm.type = paused ? SM_PAUSED : SM_PLAYING;
477     strcpy(sm.id, playing->id);
478     sm.data = playing->played / playing->format.rate;
479     speaker_send(1, &sm, 0);
480   }
481   time(&last_report);
482 }
483
484 static int addfd(int fd, int events) {
485   if(fdno < NFDS) {
486     fds[fdno].fd = fd;
487     fds[fdno].events = events;
488     return fdno++;
489   } else
490     return -1;
491 }
492
493 int main(int argc, char **argv) {
494   int n, fd, stdin_slot, alsa_slots, alsa_nslots = -1, err;
495   unsigned short alsa_revents;
496   struct track *t;
497   struct speaker_message sm;
498
499   set_progname(argv);
500   mem_init(0);
501   if(!setlocale(LC_CTYPE, "")) fatal(errno, "error calling setlocale");
502   while((n = getopt_long(argc, argv, "hVc:dD", options, 0)) >= 0) {
503     switch(n) {
504     case 'h': help();
505     case 'V': version();
506     case 'c': configfile = optarg; break;
507     case 'd': debugging = 1; break;
508     case 'D': debugging = 0; break;
509     default: fatal(0, "invalid option");
510     }
511   }
512   if(getenv("DISORDER_DEBUG_SPEAKER")) debugging = 1;
513   /* If stderr is a TTY then log there, otherwise to syslog. */
514   if(!isatty(2)) {
515     openlog(progname, LOG_PID, LOG_DAEMON);
516     log_default = &log_syslog;
517   }
518   if(config_read()) fatal(0, "cannot read configuration");
519   /* ignore SIGPIPE */
520   signal(SIGPIPE, SIG_IGN);
521   /* set nice value */
522   xnice(config->nice_speaker);
523   /* change user */
524   become_mortal();
525   /* make sure we're not root, whatever the config says */
526   if(getuid() == 0 || geteuid() == 0) fatal(0, "do not run as root");
527   info("started");
528   while(getppid() != 1) {
529     fdno = 0;
530     /* Always ready for commands from the main server. */
531     stdin_slot = addfd(0, POLLIN);
532     /* Try to read sample data for the currently playing track if there is
533      * buffer space. */
534     if(playing && !playing->eof && playing->used < playing->size) {
535       playing->slot = addfd(playing->fd, POLLIN);
536     } else if(playing)
537       playing->slot = -1;
538     /* If forceplay is set then wait until it succeeds before waiting on the
539      * sound device. */
540     if(pcm && !forceplay) {
541       int retry = 3;
542
543       alsa_slots = fdno;
544       do {
545         retry = 0;
546         alsa_nslots = snd_pcm_poll_descriptors(pcm, &fds[fdno], NFDS - fdno);
547         if((alsa_nslots <= 0
548             || !(fds[alsa_slots].events & POLLOUT))
549            && snd_pcm_state(pcm) == SND_PCM_STATE_XRUN) {
550           error(0, "underrun detected after call to snd_pcm_poll_descriptors()");
551           if((err = snd_pcm_prepare(pcm)))
552             fatal(0, "error calling snd_pcm_prepare: %d", err);
553         } else
554           break;
555       } while(retry-- > 0);
556       if(alsa_nslots >= 0)
557         fdno += alsa_nslots;
558     } else
559       alsa_slots = -1;
560     /* If any other tracks don't have a full buffer, try to read sample data
561      * from them. */
562     for(t = tracks; t; t = t->next)
563       if(t != playing) {
564         if(!t->eof && t->used < t->size) {
565           t->slot = addfd(t->fd,  POLLIN);
566         } else
567           t->slot = -1;
568       }
569     /* Wait up to a second before thinking about current state */
570     n = poll(fds, fdno, 1000);
571     if(n < 0) {
572       if(errno == EINTR) continue;
573       fatal(errno, "error calling poll");
574     }
575     /* Play some sound before doing anything else */
576     if(alsa_slots != -1) {
577       if((err = snd_pcm_poll_descriptors_revents(pcm,
578                                                  &fds[alsa_slots],
579                                                  alsa_nslots,
580                                                  &alsa_revents)) < 0)
581         fatal(0, "error calling snd_pcm_poll_descriptors_revents: %d", err);
582       if(alsa_revents & POLLOUT)
583         play(3 * FRAMES);
584     } else {
585       /* Some attempt to play must have failed */
586       if(playing && !paused)
587         play(forceplay);
588       else
589         forceplay = 0;                  /* just in case */
590     }
591     /* Perhaps we have a command to process */
592     if(fds[stdin_slot].revents & POLLIN) {
593       n = speaker_recv(0, &sm, &fd);
594       if(n > 0)
595         switch(sm.type) {
596         case SM_PREPARE:
597           D(("SM_PREPARE %s %d", sm.id, fd));
598           if(fd == -1) fatal(0, "got SM_PREPARE but no file descriptor");
599           t = findtrack(sm.id, 1);
600           acquire(t, fd);
601           break;
602         case SM_PLAY:
603           D(("SM_PLAY %s %d", sm.id, fd));
604           if(playing) fatal(0, "got SM_PLAY but already playing something");
605           t = findtrack(sm.id, 1);
606           if(fd != -1) acquire(t, fd);
607           playing = t;
608           play(pcm_bufsize);
609           report();
610           break;
611         case SM_PAUSE:
612           D(("SM_PAUSE"));
613           paused = 1;
614           report();
615           break;
616         case SM_RESUME:
617           D(("SM_RESUME"));
618           if(paused) {
619             paused = 0;
620             if(playing)
621               play(pcm_bufsize);
622           }
623           report();
624           break;
625         case SM_CANCEL:
626           D(("SM_CANCEL %s",  sm.id));
627           t = removetrack(sm.id);
628           if(t) {
629             if(t == playing) {
630               sm.type = SM_FINISHED;
631               strcpy(sm.id, playing->id);
632               speaker_send(1, &sm, 0);
633               playing = 0;
634             }
635             destroy(t);
636           } else
637             error(0, "SM_CANCEL for unknown track %s", sm.id);
638           report();
639           break;
640         case SM_RELOAD:
641           D(("SM_RELOAD"));
642           if(config_read()) error(0, "cannot read configuration");
643           info("reloaded configuration");
644           break;
645         default:
646           error(0, "unknown message type %d", sm.type);
647         }
648     }
649     /* Read in any buffered data */
650     for(t = tracks; t; t = t->next)
651       if(t->slot != -1 && (fds[t->slot].revents & POLLIN))
652          fill(t);
653     /* We might be able to play now */
654     if(pcm && forceplay && playing && !paused)
655       play(forceplay);
656     /* Maybe we finished playing a track somewhere in the above */
657     maybe_finished();
658     /* If we don't need the sound device for now then close it for the benefit
659      * of anyone else who wants it. */
660     if((!playing || paused) && pcm)
661       idle();
662     /* If we've not reported out state for a second do so now. */
663     if(time(0) > last_report)
664       report();
665   }
666   info("stopped (parent terminated)");
667   exit(0);
668 }
669 #else
670 int main(int attribute((unused)) argc, char **argv) {
671   set_progname(argv);
672   mem_init(0);
673   fatal(0, "disorder-speaker not supported on this platform");
674 }
675 #endif
676
677 /*
678 Local Variables:
679 c-basic-offset:2
680 comment-column:40
681 fill-column:79
682 indent-tabs-mode:nil
683 End:
684 */