[Alsaplayer-devel] OS X

Hans Fugal hans at fugal.net
Wed Dec 5 20:23:33 GMT 2007


Hi, trying to get AlsaPlayer running on OS X here. (Isn't it about time 
for a new name?)

This patch is needed because OS X doesn't have <malloc.h>. It should 
work fine on Linux, where the man page also states stdlib.h. malloc.h is 
probably bad form anyway.

Index: alsaplayer-0.99.80/app/reader.cpp
===================================================================
--- alsaplayer-0.99.80.orig/app/reader.cpp	2007-12-05 10:00:03.000000000 
-0700
+++ alsaplayer-0.99.80/app/reader.cpp	2007-12-05 10:11:40.000000000 -0700
@@ -21,7 +21,7 @@
   *
  */

-#include <malloc.h>
+#include <stdlib.h>
  #include <dirent.h>
  #include <sys/stat.h>
  #include <sys/types.h>
Index: alsaplayer-0.99.80/input/flac/FlacPlugin.cpp
===================================================================
--- alsaplayer-0.99.80.orig/input/flac/FlacPlugin.cpp	2007-12-05 
10:00:03.000000000 -0700
+++ alsaplayer-0.99.80/input/flac/FlacPlugin.cpp	2007-12-05 
10:12:20.000000000 -0700
@@ -28,7 +28,7 @@

  #include <string>
  #include <cstdio>
-#include <malloc.h>
+#include <stdlib.h>
  #include <cstring>
  #include <cmath>
  #include "input_plugin.h"
Index: alsaplayer-0.99.80/input/wav/wav_engine.c
===================================================================
--- alsaplayer-0.99.80.orig/input/wav/wav_engine.c	2007-12-05 
10:00:03.000000000 -0700
+++ alsaplayer-0.99.80/input/wav/wav_engine.c	2007-12-05 
10:12:24.000000000 -0700
@@ -21,7 +21,7 @@
   */

  #include <stdio.h>
-#include <malloc.h>
+#include <stdlib.h>
  #include <unistd.h>
  #include <stdlib.h>
  #include <string.h>
Index: alsaplayer-0.99.80/reader/file/file.c
===================================================================
--- alsaplayer-0.99.80.orig/reader/file/file.c	2007-12-05 
10:00:03.000000000 -0700
+++ alsaplayer-0.99.80/reader/file/file.c	2007-12-05 10:15:39.000000000 
-0700
@@ -20,7 +20,7 @@
   *
   */

-#include <malloc.h>
+#include <stdlib.h>
  #include <dirent.h>
  #include <sys/types.h>
  #include <sys/stat.h>
Index: alsaplayer-0.99.80/reader/http/http.c
===================================================================
--- alsaplayer-0.99.80.orig/reader/http/http.c	2007-12-05 
10:00:03.000000000 -0700
+++ alsaplayer-0.99.80/reader/http/http.c	2007-12-05 10:15:57.000000000 
-0700
@@ -23,7 +23,7 @@

  #include "config.h"

-#include <malloc.h>
+#include <stdlib.h>
  #include <netdb.h>
  #include <stdlib.h>
  #include <string.h>
Index: alsaplayer-0.99.80/scopes2/blurscope/blurscope.c
===================================================================
--- alsaplayer-0.99.80.orig/scopes2/blurscope/blurscope.c	2007-12-05 
10:00:03.000000000 -0700
+++ alsaplayer-0.99.80/scopes2/blurscope/blurscope.c	2007-12-05 
10:16:42.000000000 -0700
@@ -27,7 +27,7 @@
  #include <math.h>
  #include <stdio.h>
  #include <unistd.h>
-#include <malloc.h>
+#include <stdlib.h>
  #include <string.h>
  #include <assert.h>
  #include <pthread.h>
Index: alsaplayer-0.99.80/scopes2/levelmeter/levelmeter.c
===================================================================
--- alsaplayer-0.99.80.orig/scopes2/levelmeter/levelmeter.c	2007-12-05 
10:00:03.000000000 -0700
+++ alsaplayer-0.99.80/scopes2/levelmeter/levelmeter.c	2007-12-05 
10:17:43.000000000 -0700
@@ -26,7 +26,6 @@
  #include <math.h>
  #include <stdio.h>
  #include <unistd.h>
-#include <malloc.h>
  #include <string.h>
  #include <assert.h>
  #include <pthread.h>
Index: alsaplayer-0.99.80/scopes2/logbarfft/logbarfft.c
===================================================================
--- alsaplayer-0.99.80.orig/scopes2/logbarfft/logbarfft.c	2007-12-05 
10:00:03.000000000 -0700
+++ alsaplayer-0.99.80/scopes2/logbarfft/logbarfft.c	2007-12-05 
10:17:17.000000000 -0700
@@ -27,7 +27,7 @@
  #include <math.h>
  #include <stdio.h>
  #include <unistd.h>
-#include <malloc.h>
+#include <stdlib.h>
  #include <string.h>
  #include <assert.h>
  #include "scope_config.h"
Index: alsaplayer-0.99.80/scopes2/monoscope/monoscope.c
===================================================================
--- alsaplayer-0.99.80.orig/scopes2/monoscope/monoscope.c	2007-12-05 
10:00:03.000000000 -0700
+++ alsaplayer-0.99.80/scopes2/monoscope/monoscope.c	2007-12-05 
10:18:55.000000000 -0700
@@ -28,7 +28,7 @@
  #include <math.h>
  #include <stdio.h>
  #include <unistd.h>
-#include <malloc.h>
+#include <stdlib.h>
  #include <string.h>
  #include <assert.h>
  #include "scope_config.h"
Index: alsaplayer-0.99.80/scopes2/spacescope/spacescope.c
===================================================================
--- alsaplayer-0.99.80.orig/scopes2/spacescope/spacescope.c	2007-12-05 
10:00:03.000000000 -0700
+++ alsaplayer-0.99.80/scopes2/spacescope/spacescope.c	2007-12-05 
10:18:35.000000000 -0700
@@ -26,7 +26,7 @@
  #include <math.h>
  #include <stdio.h>
  #include <unistd.h>
-#include <malloc.h>
+#include <stdlib.h>
  #include <string.h>
  #include <assert.h>
  #include <pthread.h>
Index: alsaplayer-0.99.80/scopes2/synaescope/synaescope.c
===================================================================
--- alsaplayer-0.99.80.orig/scopes2/synaescope/synaescope.c	2007-12-05 
10:00:03.000000000 -0700
+++ alsaplayer-0.99.80/scopes2/synaescope/synaescope.c	2007-12-05 
10:18:09.000000000 -0700
@@ -31,7 +31,7 @@
  #include <stdio.h>
  #include <stdlib.h>
  #include <unistd.h>
-#include <malloc.h>
+#include <stdlib.h>
  #include <string.h>
  #include <assert.h>
  #include "scope_config.h"

Now I'm able to compile it but it's not working quite right.

First, it doesn't seem to be finding the plugins. Someone hardcoded 
".so", and OS X uses .dylib instead. I replaced .so with .dylib in a few 
obvious places in app/ and I'm able to load the plugins now but the help 
message still show none available.

Next, the jack ports are named differently on OS X:

cannot connect output port 1 (alsa_pcm:playback_1)
cannot connect output port 2 (alsa_pcm:playback_2)

The correct ports on OS X are coreaudio:JACK:{in,out}[12]. I think there 
must be a better way of picking the default output ports in jack these 
days, as other jack apps have no trouble autoconnecting.

Next, the GTK2 UI has no text. Blank buttons and ghostly file choosers. 
Probably a font problem of some sort. I'm using GTK2 from macports.

Not sure if it's related, but this error is being spewed forth on the 
console repeatedly:
Wed Dec  5 13:13:59 saruman.fugal.net alsaplayer[24350] <Error>: 
CGBitmapContextGetBitsPerPixel: invalid context

So I try the daemon. It runs and I can query the status, but no matter 
what I do nothing seems to add a song to the playlist. I don't know, but 
I suspect that it's because it's not finding the input plugins, and 
rejecting all the songs I try to enqueue.

-- 
Hans Fugal ; http://hans.fugal.net

There's nothing remarkable about it. All one has to do is hit the
right keys at the right time and the instrument plays itself.
     -- Johann Sebastian Bach



More information about the alsaplayer-devel mailing list