Sound in OSX working from Pearpc through ESD daemon

[ARCHIVED] About PearPC, a mostly obsolete PPC Mac emulator for Windows and Linux to run MacOS X 10.1 up to 10.4. Using QEMU is now recommended.

Moderators: Cat_7, Ronald P. Regensburg

User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Sound in OSX working from Pearpc through ESD daemon

Post by Cat_7 »

Hello, the item below was posted on the Pearpc developers list. It promises sound streamed through the ESD daemon, also available for windows. Let's give it a try!

Cat_7

Good News...

ESD works perfectly... Sound now works from within OSX 10.2 inside of
pearpc without glitches. I used a separate machine with good speakers
to output the sound. I ran ESD from windows 2000
(http://www.liquid-reality.de/main/projects/esound) with "esd -tcp
-public"
All you need to do is download the devlopment tools for OSX and
compile this driver NetworkAudioDevice.

http://cvs.opendarwin.org/index.cgi/pro ... dioDevice/

Here are the steps:

1. Download the Mac OS X development tools inside of pearpc. You have
to get this from the Apple Developer Site. Networking must be working
in pearpc for you to continue.

2. Inside of pearpc (Mac OS X) after downloading the developement
tools you can use cvs to get the NetworkAudioDevice. You do this by
running cvs inside the terminal Application!
cvs -d :pserver:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od login
<just press return for the password>

cvs -z3 -d :pserver:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od
\
co proj/NetworkAudioDevice/

3. As superuser (root) do the following (inside of PearPC Mac OSX).
You can set a root password inside a terminal by:

sudo passwd root

then type the password of your administrator account --> then type the
new root password twice

now you can do a su (super user)

Currently, the address of the esound server is hard-coded in
NetworkAudioEngine.cpp (look for ESD_HOST) : The address is in
hexidecimal (windows calculator can make the conversion if you can't
do it in your head). This is the network address of the machine you
are going to output sound to.

To install do:

make install

make load

The address is the address of the machine that you want to output the
sound to. I used a windows 2000 machine to install onto. If you have
XP you may need to make sure the sound daemon has permissions inside
windows firewall. Here is the website for the sound daemon:

http://www.liquid-reality.de/main/projects/esound

I am going to look at this driver and hack it a bit and see if we can
stream audio directly out to a dsp. I would look at this driver
because it currently works with pearpc without modification.

-Ron Stoddard
Neospy
Mac Mechanic
Posts: 186
Joined: Mon Jul 05, 2004 10:49 pm
Location: Woodway, Texas, USA
Contact:

Post by Neospy »

WOW! Great news.... I will try it out soon!


Neospy
Borg_Will_Rule
Tinkerer
Posts: 68
Joined: Thu Oct 28, 2004 5:52 am
Location: United States
Contact:

Post by Borg_Will_Rule »

I wish i could do this but its a little to far out of my league. Its a great concept though i do have to agree with everyone on that respect. Is there a way someone else could do this and make it so that we dont have to go through all the steps to do it. I am sure it would be well worth it to have sound but have no clue where to begin.
MacOSX
Tinkerer
Posts: 52
Joined: Fri Jul 30, 2004 2:23 pm
Location: Canada

Post by MacOSX »

Only for 10.2?
zuc
Student Driver
Posts: 19
Joined: Wed Aug 18, 2004 1:59 pm

Post by zuc »

According to PearPc.net it works only for 10.2 . :(
User avatar
PPC_Digger
Forum All-Star
Posts: 1050
Joined: Thu Jul 22, 2004 9:02 am
Location: Israel

Post by PPC_Digger »

Does anyone remember this?
Too bad I didn't have any UNIX sound streaming expirience back then. (I still don't :lol: )
zuc
Student Driver
Posts: 19
Joined: Wed Aug 18, 2004 1:59 pm

Post by zuc »

Seems like you where completly right.
I saw no reason why it shouldn't work too.

However, what makes me wonder is this text on the esound site:

On the windows machine you start:
esd.exe -tcp -public
(btw. don´ do this with a machine connected to the internet ;-)

Now I'm afraid of executing esd.exe -tcp -public because I'm of course connected to the internet
User avatar
PPC_Digger
Forum All-Star
Posts: 1050
Joined: Thu Jul 22, 2004 9:02 am
Location: Israel

Post by PPC_Digger »

zuc wrote:Now I'm afraid of executing esd.exe -tcp -public because I'm of course connected to the internet
Just block its port (16001) on your firewall for the internet connection (not for the mac network) and it should be fine.
User avatar
PPC_Digger
Forum All-Star
Posts: 1050
Joined: Thu Jul 22, 2004 9:02 am
Location: Israel

Post by PPC_Digger »

I got it working on 10.3 with some tweaks to the code. But it's far from smooth.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Post by Cat_7 »

Could you make the kext downloadable somewhere?

and maybe the adapted source code?

This is my post on pearpc.net about this topic:

Hi,

I have got esound to install and run on Tiger, using darwin ports.

-Install darwin ports from http://darwinports.opendarwin.org/getdp/ (for easy install, pick the dmg)
-update your path with "export PATH=$PATH:/opt/local/bin"
-run "su"
-run "port install esound" (wait a long time.....)

esound gets installed, along with a dependency, audiofile.

You can run the esound daemon with the "coreaudio" device.
Also, I believe the hard coded the ip-address issue has been resolved in the latest esound port.

The real problem is in the NetworkAudioDevice that needs to be recognized in Mac OX as a sound output device.

Now this NetworkAudioDevice does not compile on Tiger.
It complains about features available in C/Objective C, but not in C++.

I am no expert in these matters. I have tried to compile the source with different targets. Errors stay the same.
But I guess someone could update the source to be compatible with Tiger.
What we need out of this is several kext's capable of being installed on the subsequent OSX versions.

ps: "pbxbuild" has been replaced by "xcodebuild" as of 10.3
This feature allows you to compile and install without using the Xcode graphical skin.

pps: If you want to compile linux sources in Darwin (MacOS) you should copy configure.guess and configure.sub from the darwin automake-1.6 directory to your source directory. If you don't do this, Darwin is not recognized as a valid target.

Cat_7
User avatar
PPC_Digger
Forum All-Star
Posts: 1050
Joined: Thu Jul 22, 2004 9:02 am
Location: Israel

Post by PPC_Digger »

Ok, I have uploaded the modified source and a binary, hardcoded to 192.168.0.1. To install it (the binary), untar it to /System/Library/Extensions and reboot the virtual machine (don't forget to activate esd.exe).

Compiling the source is a little bit more complicated. You'll need XCode 1.5 (or 2.0 if you use Tiger, but I didn't test it) and the BSD subsystem installed properly for this to work.

If you use my modified code, skip to stage 5.
1) Download the source as described in the first post.
2) Open proj/NetworkAudioDevice/NetworkAudioDevice.pbproj in XCode.
3) Click Project>Edit Active Target 'NetworkAudioDriver'.
4) In Settings>Simple View>GCC Compiler Settings, uncheck "Treat all warnings as errors", and in "Other C Compiler Flags", delete "-Werror", and close the window.
5) Edit NetworkAudioEngine.cpp, set on line 69 "ESD_HOST" to your requested address (you must use HEX, you can use the windows calculator to convert numbers).
6) Build the file (click "Build" on the menu bar).
7) Close XCode.
8) Open the terminal. Type "su" and your root password to be root. (If you haven't set your root password yet, type "sudo passwd root", then your administrator password and the new root password twice - thanks Cat_7)
9) Go to the NetworkAudioDriver/build directory, and type "chown -R root:wheel NetworkAudioDriver.kext" to authenticate the driver.
10) Install the driver by moving it to /System/Library/Extensions:

Code: Select all

mv NetworkAudioDriver.kext /System/Library/Extensions
11) Restart, or type "kextload NetworkAudioDriver.kext".
12) Now, configure it like any other audio device (with the control panel). Again, don't forget to run "esd -tcp -public".

Enjoy!
Last edited by PPC_Digger on Sat May 21, 2005 8:59 pm, edited 1 time in total.
zuc
Student Driver
Posts: 19
Joined: Wed Aug 18, 2004 1:59 pm

Post by zuc »

PPC_Digger wrote:hardcoded to 192.168.0.1
Does that mean my Ip adress have to be 192.168.0.1? Or must the IP of the tap32 driver be 192.168.0.1?
MacOSX
Tinkerer
Posts: 52
Joined: Fri Jul 30, 2004 2:23 pm
Location: Canada

Post by MacOSX »

zuc wrote:
PPC_Digger wrote:hardcoded to 192.168.0.1
Does that mean my Ip adress have to be 192.168.0.1? Or must the IP of the tap32 driver be 192.168.0.1?
I beleieve its you TAP....i'll try it out...
User avatar
PPC_Digger
Forum All-Star
Posts: 1050
Joined: Thu Jul 22, 2004 9:02 am
Location: Israel

Post by PPC_Digger »

zuc wrote:
PPC_Digger wrote:hardcoded to 192.168.0.1
Does that mean my Ip adress have to be 192.168.0.1? Or must the IP of the tap32 driver be 192.168.0.1?
The IP address of the tap32 driver.

EDIT: lol posted at the same time.
MacOSX
Tinkerer
Posts: 52
Joined: Fri Jul 30, 2004 2:23 pm
Location: Canada

Post by MacOSX »

Bah, it says it installed improperly and stuff...
The binary is for 10.3 right?
User avatar
PPC_Digger
Forum All-Star
Posts: 1050
Joined: Thu Jul 22, 2004 9:02 am
Location: Israel

Post by PPC_Digger »

MacOSX wrote:Bah, it says it installed improperly and stuff...
The binary is for 10.3 right?
Yes. The file permissions must be set incorrectly. Try openning the terminal application and typing the following:

Code: Select all

cd /System/Library/Extensions
su
[your root password]
chown -R root:wheel NetworkAudioDevice.kext
kextload NetworkAudioDevice.kext
Good luck!
zuc
Student Driver
Posts: 19
Joined: Wed Aug 18, 2004 1:59 pm

Post by zuc »

I had the same problem but the "su" didn't work for me. I used "sudo su".
And the filename was NetworkAudioDriver.kext and not NetworkAudioDevice.kext

But now I have another problem. If I run my firewall (ZoneLabsSecurity Suite) to block the port 16001 of esd.exe, I've got no Network in PearPc and this way also no connection to the host OS. Normally I just deactivate the firewall when I wanna use PearPc, but what can I do now?
I'm behind a router but the included hardware firewall is also inactiv.
User avatar
PPC_Digger
Forum All-Star
Posts: 1050
Joined: Thu Jul 22, 2004 9:02 am
Location: Israel

Post by PPC_Digger »

If you're behind a router it will get any incoming connections and not your computer, so it should be safe to run with firewall off.
zuc
Student Driver
Posts: 19
Joined: Wed Aug 18, 2004 1:59 pm

Post by zuc »

It works now
But it's not as perfect as I thought.
It's choppy and incomplete.
Can it be that my PC is too slow?
I use a AMD Athlon XP 2500+ (1,83Ghz)
User avatar
PPC_Digger
Forum All-Star
Posts: 1050
Joined: Thu Jul 22, 2004 9:02 am
Location: Israel

Post by PPC_Digger »

zuc wrote:It works now
But it's not as perfect as I thought.
It's choppy and incomplete.
Can it be that my PC is too slow?
I use a AMD Athlon XP 2500+ (1,83Ghz)
It's choppy on my system too, an Athlon 64 3200+. The guys at pearpc.net think it's because of a timer handling difference between 10.2 and 10.3, as it should work perfectly on 10.2. I am sure a solution will be found shortly.

btw I just updated to 10.3.9, and it is a little less choppy.

EDIT: I also switched to the 3com driver and it contributes as well.
Borg_Will_Rule
Tinkerer
Posts: 68
Joined: Thu Oct 28, 2004 5:52 am
Location: United States
Contact:

Post by Borg_Will_Rule »

Up the memsize value in the configuration file to memory_size=0x65000000 having that extra virtual mem actually speeds things up a bit and may also help a bit with the choppiness. that is what was told by my cous, i wish i could get this sound thing to work but i have no clue how :(
MacOSX
Tinkerer
Posts: 52
Joined: Fri Jul 30, 2004 2:23 pm
Location: Canada

Post by MacOSX »

Just a suggestion, if you are having difficulties working in the Terminal, you should Log In as root first, then proceed to do the changes in Terminal.

Heres how:

If you have a root account and password, skip to 4.

1. Open NetInfo Manager, located in Applications > Utilities.

2. Choose Security > Enable Root User and type a password for the root account. You may need to type an administrator password to make these changes.

3. Choose Apple menu> Log Out.

4. Choose Other in the Login window, type root in the Name field, and the root password in the Password field.

5. Proceed to do the changes in Terminal.

MacOSX
MacOSX
Tinkerer
Posts: 52
Joined: Fri Jul 30, 2004 2:23 pm
Location: Canada

Post by MacOSX »

I don't know if I'm being stupid or not but it seens that if you set the volume lower, it's smoother...or atleast after a while...

MacOSX
User avatar
PPC_Digger
Forum All-Star
Posts: 1050
Joined: Thu Jul 22, 2004 9:02 am
Location: Israel

Post by PPC_Digger »

MacOSX wrote:I don't know if I'm being stupid or not but it seens that if you set the volume lower, it's smoother...or atleast after a while...

MacOSX
It is a little logical. Think about it that way: the lower the volume is, the smaller the sound amplitudes are, and the less work OSX has to do in order to play the sound. I think you're on to something.
MacOSX
Tinkerer
Posts: 52
Joined: Fri Jul 30, 2004 2:23 pm
Location: Canada

Post by MacOSX »

PPC_Digger wrote:
MacOSX wrote:I don't know if I'm being stupid or not but it seens that if you set the volume lower, it's smoother...or atleast after a while...

MacOSX
It is a little logical. Think about it that way: the lower the volume is, the smaller the sound amplitudes are, and the less work OSX has to do in order to play the sound. I think you're on to something.
I might be wrong because there are no volume level comtrol in OS X for the Network Driver....If you look in System Preferences, Sound, you'll see that the driver has no audio output controls...

MacOSX
Locked