*
* This program is responsible for transmitting a single coherent audio stream
* to its destination (over the network, to some sound API, to some
- * subprocess). It receives connections from decoders via file descriptor
- * passing from the main server and plays them in the right order.
+ * subprocess). It receives connections from decoders (or rather from the
+ * process that is about to become disorder-normalize) and plays them in the
+ * right order.
*
* @b Encodings. For the <a href="http://www.alsa-project.org/">ALSA</a> API,
* 8- and 16- bit stereo and mono are supported, with any sample rate (within
/** @brief Table of speaker backends */
static const struct speaker_backend *backends[] = {
-#if API_ALSA
+#if HAVE_ALSA_ASOUNDLIB_H
&alsa_backend,
#endif
&command_backend,
&network_backend,
+#if HAVE_COREAUDIO_AUDIOHARDWARE_H
+ &coreaudio_backend,
+#endif
+#if HAVE_SYS_SOUNDCARD_H
+ &oss_backend,
+#endif
0
};
uint32_t l;
char id[24];
- if((fd = accept(listenfd, &addr, &addrlen)) >= 0) {
+ if((fd = accept(listenfd, (struct sockaddr *)&addr, &addrlen)) >= 0) {
+ blocking(fd);
if(read(fd, &l, sizeof l) < 4) {
error(errno, "reading length from inbound connection");
xclose(fd);
int n;
struct sockaddr_un addr;
static const int one = 1;
+ struct speaker_message sm;
set_progname(argv);
if(!setlocale(LC_CTYPE, "")) fatal(errno, "error calling setlocale");
if(unlink(addr.sun_path) < 0 && errno != ENOENT)
error(errno, "removing %s", addr.sun_path);
xsetsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof one);
- if(bind(listenfd, &addr, sizeof addr) < 0)
+ if(bind(listenfd, (const struct sockaddr *)&addr, sizeof addr) < 0)
fatal(errno, "error binding socket to %s", addr.sun_path);
xlisten(listenfd, 128);
nonblock(listenfd);
info("listening on %s", addr.sun_path);
+ memset(&sm, 0, sizeof sm);
+ sm.type = SM_READY;
+ speaker_send(1, &sm);
mainloop();
info("stopped (parent terminated)");
exit(0);