the Fink project is an effort to port
popular Unix programs to Mac OS X
Package: esound
Version: 0.2.41
Revision: 2
BuildDependsOnly: True
Depends: %N-bin (>= %v-%r), macosx, pkgconfig
BuildDepends: fink (>= 0.24.12), audiofile (>= 0.2.4-1), macosx, docbook-utils (>= 0.6.14-1), pkgconfig
DescPackaging: <<
Uses pkgconfig.
Any package which BuildDepends on this one must also BuildDepend on:
audiofile (>= 0.2.4-1)
Originally packaged by Masanori Sekino.
<<
Source: mirror:gnome:sources/%n/0.2/%n-%v.tar.bz2
Source-MD5: 8d9aad3d94d15e0d59ba9dc0ea990c6c
PatchFile: %n.patch
PatchFile-MD5: 25412de2a1d9b336691adc54b8b35a92
PatchScript: <<
%{default_script}
perl -pi -e 's/(SOUND_LIBS="-Wl,-framework) -Wl,(CoreAudio")/$1,$2/' configure
perl -pi -e 's|http://www.oasis-open.org/docbook/xml|%p/share/xml/dtd/docbookx|' docs/esound.sgml
<<
NoSetMAKEFLAGS: true
SetMAKEFLAGS: -j1
NoSetCPPFLAGS: true
NoSetLDFLAGS: true
SetCPPFLAGS: -pipe
ConfigureParams: --mandir=%p/share/man --htmldir=%p/share/doc/esound/html --with-libwrap --disable-dependency-tracking
CompileScript: <<
./configure %c
make -j2 EGREP='grep -E' max_cmd_len=1024
<<
InstallScript: make install DESTDIR=%d
SplitOff: <<
Package: %N-shlibs
Depends: %N-common (>= %v-%r), audiofile-shlibs (>= 0.2.4-1)
Replaces: %N (<< 0.2.38-1)
Files: lib/libesd.*.dylib
Shlibs: %p/lib/libesd.0.dylib 3.0.0 %n (>= 0.2.28-1)
DocFiles: AUTHORS COPYING* ChangeLog NEWS README TIPS TODO
<<
SplitOff2: <<
Package: %N-bin
Depends: %N-shlibs (>= %v-%r)
Replaces: %N (<< 0.2.38-1)
Files: <<
bin/esd bin/esdcat bin/esdctl bin/esdfilt bin/esdloop
bin/esdmon bin/esdplay bin/esdrec bin/esdsample
share/man/man1
<<
DocFiles: AUTHORS COPYING* ChangeLog NEWS README TIPS TODO
<<
SplitOff3: <<
Package: %N-common
Provides: %N-data
Replaces: %N (<< 0.2.38-1), %N-data
Conflicts: %N-data
Files: etc
ConfFiles: %p/etc/esd.conf
DocFiles: AUTHORS COPYING* ChangeLog NEWS README TIPS TODO
<<
DocFiles: AUTHORS COPYING* ChangeLog NEWS README TIPS TODO
Description: Enlightened Sound Daemon
DescDetail: <<
EsounD, the Enlightened Sound Daemon, is a server process that mixes
several audio streams for playback by a single audio device. For
example, if you're listening to music on a CD and you receive a
sound-related event from ICQ, the two applications won't have to
jockey for the use of your sound card.
<<
DescPort: <<
This package uses a patch by Shawn Hsiao and Masanori Sekino to enable
playback and recording via the CoreAudio API. It uses some evil hacking
to keep the CoreAudio dependency out of the library - there were
symbol clashes between CarbonCore (one of CoreAudio's dependencies)
and several esd-using programs.
Also needs some help to link against the right copy of its own library.
Applied a iMacs/eMacs patch from Alexander Strange (>= 0.2.28).
Detects ARTS, but then doesn't use it (?) so no need for dependencies.
Do not link util.o into esd executable because that object is already
present as libesd_la-util.o in libesd.dylib, which is also linked into
esd. See: http://bugzilla.gnome.org/show_bug.cgi?id=317554
Employs a patch from Ojas Parekh for CoreAudio device selection.
http://bugzilla.gnome.org/show_bug.cgi?id=478292
<<
DescUsage: <<
Users have reported that esd can suddenly stop producing sound due to
changes to the OS X MIDI output bit-rate, and that 44100 Hz works.
<<
License: GPL/LGPL
Maintainer: Ojas Parekh
Homepage: http://www.gnome.org/
diff -Nurd -x'*~' esound-0.2.36.orig/Makefile.in esound-0.2.36/Makefile.in
--- esound-0.2.36.orig/Makefile.in 2005-06-06 21:04:14.000000000 -0400
+++ esound-0.2.36/Makefile.in 2005-09-30 18:29:03.000000000 -0400
@@ -422,7 +421,7 @@
esdplay.c
LDADD = libesd.la $(AUDIOFILE_LIBS)
-esd_LDADD = $(WRAP_LIB) $(LDADD)
+esd_LDADD = $(WRAP_LIB) $(LDADD) $(SOUND_LIBS)
m4datadir = $(datadir)/aclocal
m4data_DATA = esd.m4
esdconfdir = $(sysconfdir)
diff -Nurd -x'*~' esound-0.2.36.orig/esd.c esound-0.2.36/esd.c
--- esound-0.2.36.orig/esd.c 2005-05-25 21:02:52.000000000 -0400
+++ esound-0.2.36/esd.c 2005-09-30 18:27:06.000000000 -0400
@@ -35,6 +35,13 @@
/* max arguments (argc + tokenized esd.conf) can't be more than this */
#define MAX_OPTS 128
+#if defined (__APPLE__)
+#include
+#include
+#include
+#include
+#endif
+
typedef const char *(*audio_devices_t)(void);
typedef int (*audio_open_t)(void);
typedef void (*audio_close_t)(void);
@@ -641,6 +648,29 @@
int default_format = ESD_BITS16 | ESD_STEREO;
/* end test scaffolding parameters */
+#if defined (__APPLE__)
+ /* get realtime priority */
+ {
+ struct thread_time_constraint_policy ttcpolicy;
+ int bus_speed, mib [2] = { CTL_HW, HW_BUS_FREQ };
+ size_t len;
+
+ len = sizeof (bus_speed);
+ sysctl (mib, 2, &bus_speed, &len, NULL, 0);
+
+ /* Is it enough? */
+ ttcpolicy.period = bus_speed / 120;
+ ttcpolicy.computation = bus_speed / 2400;
+ ttcpolicy.constraint = bus_speed / 1200;
+ ttcpolicy.preemptible = 1;
+
+ thread_policy_set (mach_thread_self (),
+ THREAD_TIME_CONSTRAINT_POLICY,
+ (int*)&ttcpolicy,
+ THREAD_TIME_CONSTRAINT_POLICY_COUNT);
+ }
+#endif
+
programname = *argv;
#ifdef DRIVER_ARTS
diff -Nurd -x'*~' esound-0.2.36.orig/esd.conf esound-0.2.36/esd.conf
--- esound-0.2.36.orig/esd.conf 2004-08-18 15:01:41.000000000 -0400
+++ esound-0.2.36/esd.conf 2005-09-30 18:27:06.000000000 -0400
@@ -1,6 +1,6 @@
[esd]
auto_spawn=1
spawn_options=-terminate -nobeeps -as 2
-spawn_wait_ms=100
+spawn_wait_ms=999
# default options are used in spawned and non-spawned mode
default_options=
diff -Nurd -x'*~' esound-0.2.36.orig/esd_config.c esound-0.2.36/esd_config.c
--- esound-0.2.36.orig/esd_config.c 2005-05-25 19:50:41.000000000 -0400
+++ esound-0.2.36/esd_config.c 2005-09-30 18:27:06.000000000 -0400
@@ -9,7 +9,7 @@
int esd_no_spawn=1; /* If we can't even find the system config file,
things are screwed up - don't try to make things
worse. */
-int esd_spawn_wait_ms=100; /* Time to wait trying to connect to an
+int esd_spawn_wait_ms=999; /* Time to wait trying to connect to an
autospawned ESD, in milliseconds. */
char esd_spawn_options[LINEBUF_SIZE] = "-terminate -nobeeps -as 2";
diff -urN esound-0.2.36.orig/audio_coreaudio.c esound-0.2.36/audio_coreaudio.c
--- esound-0.2.36.orig/audio_coreaudio.c 2003-06-18 08:12:23.000000000 -0400
+++ esound-0.2.36/audio_coreaudio.c 2007-09-07 18:53:46.000000000 -0400
@@ -90,7 +90,7 @@
#define ARCH_esd_audio_devices
const char *esd_audio_devices()
{
- return "coreaudio API only";
+ return "Built-in Output, Built-in Input, etc.";
}
/*
@@ -116,18 +116,158 @@
return (0);
}
- /********************** playback section ***************************/
- /* get default output device */
- propertySize = sizeof(gOutputDeviceID);
- status = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice,
- &propertySize,
- &gOutputDeviceID);
- if (status) {
- fprintf(stderr, "get default output device failed, status = %d\n",
- (int)status);
- return (-2);
+ if (esd_audio_device) {
+ /* search for DeviceID of specified device */
+ UInt32 outSize;
+ UInt32 devIndex, numDevs;
+ UInt32 buffIndex, numChannels;
+ AudioDeviceID dev, *devList = NULL;
+ AudioBufferList *buffList = NULL;
+
+ outSize = 0;
+ status = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices,
+ &outSize,
+ NULL);
+ if (status || outSize == 0) {
+ fprintf(stderr, "get device list info failed, status = %d\n",
+ (int)status);
+ return (-2);
+ }
+
+ numDevs = outSize/sizeof(AudioDeviceID);
+
+ /* allocate and get the device list */
+ devList = (AudioDeviceID*)malloc(outSize);
+ if (!devList) {
+ fprintf(stderr, "memory allocation failed\n");
+ return (-2);
+ }
+ status = AudioHardwareGetProperty(kAudioHardwarePropertyDevices,
+ &outSize,
+ devList);
+ if (status) {
+ fprintf(stderr, "get device list failed, status = %d\n",
+ (int)status);
+ if (devList) free(devList);
+ return (-2);
+ }
+
+ /* iterate through device list */
+ for (devIndex = 0; devIndex < numDevs; ++devIndex) {
+ outSize = LEN_DEVICE_NAME;
+ status = AudioDeviceGetProperty(devList[devIndex],
+ 0,
+ 0,
+ kAudioDevicePropertyDeviceName,
+ &outSize,
+ deviceName);
+ if (status) {
+ fprintf(stderr, "get device name failed, status = %d\n",
+ (int)status);
+ if (devList) free(devList);
+ return (-2);
+ }
+
+ /* is this the specified device? */
+ if (strncmp(deviceName, esd_audio_device, strlen(esd_audio_device)) == 0) {
+ /* device found, now probe for num inputs/outputs */
+ dev = devList[devIndex];
+
+ /* get number of input channels */
+ outSize = 0;
+ numChannels = 0;
+ status = AudioDeviceGetPropertyInfo(dev,
+ 0,
+ 1,
+ kAudioDevicePropertyStreamConfiguration,
+ &outSize,
+ NULL);
+ if(!status && (outSize != 0)) {
+ buffList = (AudioBufferList*)malloc(outSize);
+ if (!buffList) {
+ fprintf(stderr, "memory allocation failed\n");;
+ return (-2);
+ }
+ /* get the input stream configuration */
+ status = AudioDeviceGetProperty(dev,
+ 0,
+ 1,
+ kAudioDevicePropertyStreamConfiguration,
+ &outSize,
+ buffList);
+ if(!status) {
+ /* count the total number of input channels in the stream */
+ for(buffIndex = 0; buffIndex < buffList->mNumberBuffers; ++buffIndex)
+ numChannels += buffList->mBuffers[buffIndex].mNumberChannels;
+ }
+ }
+
+ /* set input device */
+ if (numChannels == 0)
+ gInputDeviceID = kAudioDeviceUnknown;
+ else
+ gInputDeviceID = dev;
+
+
+ /* get number of output channels */
+ outSize = 0;
+ numChannels = 0;
+ status = AudioDeviceGetPropertyInfo(dev,
+ 0,
+ 0,
+ kAudioDevicePropertyStreamConfiguration,
+ &outSize,
+ NULL);
+ if(!status && (outSize != 0)) {
+ buffList = (AudioBufferList*)malloc(outSize);
+ if (!buffList) {
+ fprintf(stderr, "memory allocation failed\n");
+ return (-2);
+ }
+ /* get the input stream configuration */
+ status = AudioDeviceGetProperty(dev,
+ 0,
+ 0,
+ kAudioDevicePropertyStreamConfiguration,
+ &outSize,
+ buffList);
+ if(!status) {
+ // count the total number of input channels in the stream
+ for(buffIndex = 0; buffIndex < buffList->mNumberBuffers; ++buffIndex)
+ numChannels += buffList->mBuffers[buffIndex].mNumberChannels;
+ }
+ }
+
+ if (numChannels == 0)
+ gOutputDeviceID = kAudioDeviceUnknown;
+ else
+ gOutputDeviceID = dev;
+
+ /* found specified device so break */
+ break;
+ }
+ }
+ if (devList) free(devList);
+ if (devIndex >= numDevs) {
+ fprintf(stderr, "device not found\n");
+ return (-2);
+ }
}
+ /********************** playback section ***************************/
+ if (gOutputDeviceID == kAudioDeviceUnknown) {
+ /* get default output device */
+ propertySize = sizeof(gOutputDeviceID);
+ status = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice,
+ &propertySize,
+ &gOutputDeviceID);
+ if (status) {
+ fprintf(stderr, "get default output device failed, status = %d\n",
+ (int)status);
+ return (-2);
+ }
+ }
+
if (gOutputDeviceID != kAudioDeviceUnknown) {
/* got default output device */
coreaudio_has_output_device = 1;
@@ -206,15 +346,17 @@
}
/********************** record section ***************************/
- /* get default input device */
- propertySize = sizeof(gInputDeviceID);
- status = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice,
- &propertySize,
- &gInputDeviceID);
- if (status) {
- fprintf(stderr, "get default input device failed, status = %d\n",
- (int)status);
- return (-2);
+ if (gInputDeviceID == kAudioDeviceUnknown) {
+ /* get default input device */
+ propertySize = sizeof(gInputDeviceID);
+ status = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice,
+ &propertySize,
+ &gInputDeviceID);
+ if (status) {
+ fprintf(stderr, "get default input device failed, status = %d\n",
+ (int)status);
+ return (-2);
+ }
}
if (gInputDeviceID != kAudioDeviceUnknown) {
diff -Naur esound-0.2.38.orig/esdlib.c esound-0.2.38/esdlib.c
--- esound-0.2.38.orig/esdlib.c 2007-04-19 14:43:59.000000000 +0000
+++ esound-0.2.38/esdlib.c 2010-01-27 17:02:20.000000000 +0000
@@ -708,7 +708,7 @@
if ( !host ) host = getenv("ESPEAKER");
display = getenv( "DISPLAY" );
- if ( !(host && *host) && display ) {
+ if ( !(host && *host) && display /* Fink: launchd socket */ && display[0] != '/') {
/* no espeaker specified, but the app should be directed to a
remote display, so try routing the default port over there
and see if we strike gold */