File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes RTP and Java 3D sounds Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "RTP and Java 3D sounds" Watch "RTP and Java 3D sounds" New topic

RTP and Java 3D sounds

Tracey Lowe

Joined: Jan 23, 2001
Posts: 1
I am trying to receive RTP audio and then play it using the Java 3D sound APIs. I am sucessfully receiving the audio, but cannot get it to play through the Java 3D PointSound class.
I created a PipedOutputStream and PipedInputStream and connected those. Then I created an AudioInputStream from the PipedInputStream and set that AudioInputStream as the source for the PointSound. Below is a code snipet showing how I set this up:
pout = new PipedOutputStream();
pin = new PipedInputStream(pout);
catch (Exception e)
System.out.println("Piped input error");

AudioFormat af = new AudioFormat (AudioFormat.Encoding.ULAW, 8000, 8, 1, 1, 8000, true);
astream = new AudioInputStream(pin, af, 8000);

sample = new MediaContainer(astream);

Point3f soundPos = new Point3f(-30.0f, 0.0f, 0.0f);

Then I have a Thread that accepts the RTP packets, strips off the RTP header and writes the raw audio data into the PipedOutputStream and tells the sound to start playing. What I was expecting to happen was that I was writing to the PipedOutputStream, which was the source for the sound that I wanted to play, so the sound would be read out of the stream as it was written into the stream. What actually happened is that data was written into the PipedOutputStream until the buffer was full and no sound was played.
Does anyone have any ideas if this should work?
I agree. Here's the link:
subject: RTP and Java 3D sounds
It's not a secret anymore!