Intel Spatial Audio for Java* Package TutorialLesson 7: Streaming
Goal: This lesson covers the use of streaming media in the Intel Spatial Audio for Java* package. The package provides support for streaming sound sources and streaming listeners. The Streaming Sound Source The applet generates its tune by filling up a buffer with data for a random note, then submitting that buffer to the streaming sound source using the submitBuffer() method. When you submit a buffer, you can specify an argument to an event which will be signaled when the audio renderer is finished with the buffer. In this way, you can re-use the buffers rather than allocate more and more memory. This applet uses four steps to accomplish the streaming:
buffer1 = new BufferHolder(dataRest, (Object)"event1", null, this);
streamingSoundSource.flush();
b.data = getCurrentNote(); streamingSoundSource.submitBuffer(b);
public boolean handleEvent(Event evt) {switch(evt.id) {case SoundSource.BUFFER_EVENT:if (evt.arg == "event1") { playNextNote(buffer1); return true; } if (evt.arg == "event2") { playNextNote(buffer2); return true; } if (evt.arg == "event3") { playNextNote(buffer3); return true; }} // switch...} The Streaming Listener While a direct listener sends the data data generated by the audio renderer directly to the audio output device (usually headphones or speakers), the streaming listener receives buffers of data via its requestBuffer() method. Please refer to the documentation in the User's Guide for details and a simple usage model.
This page was last updated on Feb 11th, 1997.
|