org.xith3d.sound
Interface SoundContainer

All Known Subinterfaces:
SingletonSoundContainer
All Known Implementing Classes:
MidiSoundContainer, OggSoundContainer, WaveSoundContainer

public interface SoundContainer

A sound data container is what acts as a generator for the actual sound data which will be played. Containers load all their data into memory, or they can load the data in chunks. Chunked data is called by the sound driver on demand, allowing for data to be decompressed in a double buffered stream.

Important note: Streamable data containers cannot be attached to more than one source at a time. In general you only need to stream the very large files and they would use a fairly small amount of memory.


Method Summary
 SoundBuffer getData(SoundDriver driver)
          Gets a buffer to be played.
 boolean isStreaming()
           
 void returnData(SoundDriver driver, SoundBuffer buffer)
          Called by the sound system to indicate that it has finished playing the buffer.
 void rewind(SoundDriver driver)
          Generally only valid for streaming sound containers.
 

Method Detail

isStreaming

boolean isStreaming()
Returns:
if there might be more than one sound buffer available.

getData

SoundBuffer getData(SoundDriver driver)
Gets a buffer to be played.

Returns:
The buffer ready to be played. Null indicates there is no more data to be played.

returnData

void returnData(SoundDriver driver,
                SoundBuffer buffer)
Called by the sound system to indicate that it has finished playing the buffer. In a streaming implementation this is an opportunity to decode the next chunk into this released buffer.

Parameters:
buffer -

rewind

void rewind(SoundDriver driver)
Generally only valid for streaming sound containers. Sets up for a call to the getData() method. The next call to getData() should return the first buffer in the sound source.

Parameters:
driver -