Themaister / RSound

A multi-platform, simple PCM audio server and client.
http://www.rsound.org
GNU General Public License v3.0
30 stars 3 forks source link

mac os x and arm plugpc #1

Open tristan-k opened 13 years ago

tristan-k commented 13 years ago

I followed the instructions at http://hunterdavis.com/archives/2269 in order to get a rsd server running at my seagate dockstar with debian squeeze. What I want is to stream sound from mac os x lion to the plugpc. I compiled rsound successfully on both machines and tried to stream a test.wav from mac os x to debian squeeze.

On mac os x: rsdplay tk-ds-debian < /Users/tristank/Desktop/test.wav (librsound): PID: 75739: ERROR: Server hung up (librsound): PID: 75739: ERROR: Couldn't receive chunk. (librsound): PID: 75739: ERROR: Get backend info failed! (librsound): PID: 75739: ERROR: rsd_start() failed! Failed to establish connection to server

On debian squeeze:

$ rsd -v -b alsa -d hw:0,0 Connection :: [ 2011-09-14 - 16:16:11 ] [ 192.168.178.39 ] ::

I do have a working mpd server with my alsa soundcard. Any suggestions?

Themaister commented 13 years ago

On 09/14/2011 04:26 PM, LaTristesse wrote:

I followed the instructions at http://hunterdavis.com/archives/2269 in order to get a rsd server running at my seagate dockstar with debian squeeze. What I want is to stream sound from mac os x lion to the plugpc. I compiled rsound successfully on both machines and tried to stream a test.wav from mac os x to debian squeeze.

On mac os x: rsdplay tk-ds-debian< /Users/tristank/Desktop/test.wav (librsound): PID: 75739: ERROR: Server hung up (librsound): PID: 75739: ERROR: Couldn't receive chunk. (librsound): PID: 75739: ERROR: Get backend info failed! (librsound): PID: 75739: ERROR: rsd_start() failed! Failed to establish connection to server

On debian squeeze:

$ rsd -v -b alsa -d hw:0,0 Connection :: [ 2011-09-14 - 16:16:11 ] [ 192.168.178.39 ] ::

I do have a working mpd server with my alsa soundcard. Any suggestions?

Hm, using -d hw:0,0 might not work properly unless the rate, formats, match, etc, since no conversion is performed. Tried omitting -d? You could also try enforcing sample rate conversion using -R to what your card supports natively. Note that you cannot play two streams at the same time using -d hw:0,0 either.

rsd should run just fine on dmixer so unless you have to, I recommend avoiding using -d :)

tristan-k commented 13 years ago

Thanks Themaister. It worked by omitting any options at all. Just:

$ rsd -v

Now how it is possilbe to stream the output from a mac os x application to the rsd server?

Themaister commented 13 years ago

That's the hard part. Since I cannot/don't-know-how-to plug into the OSX audio stack, I cannot do it generally for every application. However, I have made some patches for some of the popular ones. In the source repo under patches/ you'll find some.

MPlayer2 has RSound support merged in. MPD has a patch. VLC has a plugin.

tristan-k commented 13 years ago

Whats about using soundflower to redirect the default output to it. AirFoil is using a similar approach with its "Instant On" feature.

I'm not that well educated in compiling stuff but I tried to install the vlc patch. It results in an error saying:

$ cd '/Users/tristank/Documents/github.com/RSound/patches/vlc/' $ make Package vlc-plugin was not found in the pkg-config search path. Perhaps you should add the directory containing `vlc-plugin.pc' to the PKG_CONFIG_PATH environment variable No package 'vlc-plugin' found Makefile:11: *\ "Cannot find VLC plugin pkg-conf...". Stop.

Could it be possible that VLC is using a different architecture in mac os x than in linux? Do you succeed in using it on a mac?

Themaister commented 13 years ago

I don't really own a Mac, well a G4 PowerMac from 2002, but, it takes aeons to compile stuff on it.

Maybe you have to install VLC from MacPorts if that's possible. I doubt the regular OSX build of VLC ships with headers, and that stuff. But yes, that header is geared for Linux, but MacPorts is almost like being on Linux/BSD, so :D

Themaister commented 13 years ago

Just looked quickly at soundflower, and it seemed neat. Kinda like JACK :D Anyways, I knocked up a quick app that reads from an input using PortAudio and just pass it straight to RSound. It seems to actually work, so might work more on it.

You might want to give it a shot at least. Here's the source: https://gist.github.com/1223899

Compile with: gcc -o flowersound flowersound.c -lportaudio -lrsound -L/opt/local/lib -I/opt/local/include You'll need to install portaudio from macports or something.

If you then set soundflower as default input/output, you could try running with: RSD_SERVER=ip ./flowersound

You might have to play around with buffer settings in soundflower too.

tristan-k commented 13 years ago

I installed VLC from macports but now I'm getting a huge list of errors:

$ cd '/Users/tristank/Documents/github.com/RSound/patches/vlc/' $ make cc -c -o rsound-plugin.o rsound-plugin.c -fPIC -O2 -g -std=gnu99 -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98 -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE -I/opt/local/include -I/opt/local/include/vlc/plugins -DMODULE_STRING=\"RSound\" rsound-plugin.c:36:20: error: vlcfs.h: No such file or directory rsound-plugin.c:60: error: expected ‘)’ before ‘’ token rsound-plugin.c:63: error: expected ‘)’ before ‘_’ token rsound-plugin.c:85:45: error: macro "add_string" requires 6 arguments, but only 5 given rsound-plugin.c:87:45: error: macro "add_string" requires 6 arguments, but only 5 given rsound-plugin.c: In function ‘vlc_entry__main’: rsound-plugin.c:84: error: ‘add_string’ undeclared (first use in this function) rsound-plugin.c:84: error: (Each undeclared identifier is reported only once rsound-plugin.c:84: error: for each function it appears in.) rsound-plugin.c:86: error: expected ‘;’ before ‘add_string’ rsound-plugin.c: In function ‘Open’: rsound-plugin.c:99: error: ‘audio_output_t’ undeclared (first use in this function) rsound-plugin.c:99: error: ‘p_aout’ undeclared (first use in this function) rsound-plugin.c:99: error: expected expression before ‘)’ token rsound-plugin.c:115: warning: implicit declaration of function ‘var_InheritString’ rsound-plugin.c:115: warning: initialization makes pointer from integer without a cast rsound-plugin.c:121: warning: initialization makes pointer from integer without a cast rsound-plugin.c:164: warning: type defaults to ‘int’ in declaration of ‘type name’ rsound-plugin.c:164: error: invalid type argument of ‘->’ rsound-plugin.c:174: error: ‘VLC_CODECS16N’ undeclared (first use in this function) rsound-plugin.c:176: error: ‘Play’ undeclared (first use in this function) rsound-plugin.c:182: warning: type defaults to ‘int’ in declaration of ‘type name’ rsound-plugin.c:182: error: invalid type argument of ‘->’ rsound-plugin.c:192: warning: type defaults to ‘int’ in declaration of ‘type name’ rsound-plugin.c:192: error: invalid type argument of ‘->’ rsound-plugin.c: At top level: rsound-plugin.c:204: error: expected ‘)’ before ‘’ token rsound-plugin.c: In function ‘Close’: rsound-plugin.c:214: error: ‘audio_output_t’ undeclared (first use in this function) rsound-plugin.c:214: error: ‘paout’ undeclared (first use in this function) rsound-plugin.c:214: error: expected expression before ‘)’ token rsound-plugin.c: At top level: rsound-plugin.c:232: error: expected ‘)’ before ‘’ token rsound-plugin.c: In function ‘RSDThread’: rsound-plugin.c:247: error: ‘audio_output_t’ undeclared (first use in this function) rsound-plugin.c:247: error: ‘p_aout’ undeclared (first use in this function) rsound-plugin.c:261: warning: implicit declaration of function ‘BufferDuration’ rsound-plugin.c:270: warning: type defaults to ‘int’ in declaration of ‘type name’ rsound-plugin.c:270: error: invalid type argument of ‘->’ rsound-plugin.c:284: error: ‘aout_buffer_t’ has no member named ‘i_buffer’ rsound-plugin.c:288: warning: type defaults to ‘int’ in declaration of ‘type name’ rsound-plugin.c:288: error: invalid type argument of ‘->’ make: *\ [rsound-plugin.o] Error 1

Themaister commented 13 years ago

Hm, seems like VLC broke their APIs (again). Don't have quick solution for that. Did you try the sunflower stuff I linked over?