com.flagstone.transform.util.sound
Interface SoundDecoder

All Known Implementing Classes:
MP3Decoder, WAVDecoder

public interface SoundDecoder

SoundDecoder is an interface that classes used to decode different sound formats should implement in order to be registered with the SoundRegistry.


Method Summary
 DefineSound defineSound(int identifier)
          Define an event sound.
 DefineSound defineSound(int identifier, float duration)
          Define an event sound.
 void read(File file)
          Read a sound from a file.
 void read(InputStream stream)
          Read a sound from an input stream.
 void read(URL url)
          Read a sound from a file referenced by a URL.
 MovieTag streamHeader(float frameRate)
          Generate the header for a streaming sound.
 MovieTag streamSound()
          Generate a SoundStreamBlock with next set of sound samples.
 

Method Detail

read

void read(File file)
          throws IOException,
                 DataFormatException
Read a sound from a file.

Parameters:
file - the path to the file.
Throws:
IOException - if there is an error reading the sound data.
DataFormatException - if the file contains an unsupported format.

read

void read(URL url)
          throws IOException,
                 DataFormatException
Read a sound from a file referenced by a URL.

Parameters:
url - the reference to the file.
Throws:
IOException - if there is an error reading the sound data.
DataFormatException - if the file contains an unsupported format.

read

void read(InputStream stream)
          throws IOException,
                 DataFormatException
Read a sound from an input stream.

Parameters:
stream - the stream used to read the sound data.
Throws:
IOException - if there is an error reading the sound data.
DataFormatException - if the file contains an unsupported format.

defineSound

DefineSound defineSound(int identifier)
                        throws IOException,
                               DataFormatException
Define an event sound.

Parameters:
identifier - he unique identifier that will be used to reference the sound in a Movie.
Returns:
the definition used to add the sound to a Movie.
Throws:
IOException - if there is an error reading the sound data.
DataFormatException - if the file contains an unsupported format.

defineSound

DefineSound defineSound(int identifier,
                        float duration)
                        throws IOException,
                               DataFormatException
Define an event sound.

Parameters:
identifier - the unique identifier that will be used to reference the sound in a Movie.
duration - the number of seconds to play the sound for.
Returns:
the definition used to add the sound to a Movie.
Throws:
IOException - if there is an error reading the sound data.
DataFormatException - if the file contains an unsupported format.

streamHeader

MovieTag streamHeader(float frameRate)
Generate the header for a streaming sound.

Parameters:
frameRate - the frame rate for the movie so the sound can be divided into sets of samples that can be played with each frame.
Returns:
the stream header object that contains information about the sound.

streamSound

MovieTag streamSound()
                     throws IOException,
                            DataFormatException
Generate a SoundStreamBlock with next set of sound samples.

Returns:
a SoundStreamBlock containing the sound samples or null if there are no more samples to available.
Throws:
IOException - if there is an error reading the sound data.
DataFormatException - if the file contains an unsupported format.


Copyright © 2002-2010 Flagstone Software Ltd.. All Rights Reserved.