|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.flagstone.transform.sound.SoundStreamHead
public final class SoundStreamHead
SoundStreamHead defines the format of a streaming sound, identifying the encoding scheme, the rate at which the sound will be played and the size of the decoded samples.
Sounds may be either mono or stereo and encoded using either NATIVE_PCM, ADPCM, MP3 or NELLYMOSER formats and have sampling rates of 5512, 11025, 22050 or 44100 Hz.
The actual sound is streamed used the SoundStreamBlock class which contains the data for each frame in a movie.
When a stream sound is played if the Flash Player cannot render the frames fast enough to maintain synchronisation with the sound being played then frames will be skipped. Normally the player will reduce the frame rate so every frame of a movie is played. The different sets of attributes that identify how the sound will be played compared to the way it was encoded allows the Player more control over how the animation is rendered. Reducing the resolution or playback rate can improve synchronisation with the frames displayed.
SoundStreamHead2 allows way the sound is played to differ from the way it is encoded and streamed to the player. This allows the Player more control over how the animation is rendered. Reducing the resolution or playback rate can improve synchronisation with the frames displayed.
SoundStreamBlock,
SoundStreamHead2| Constructor Summary | |
|---|---|
SoundStreamHead(int playbackRate,
int playbackChannels,
int playSize,
int streamingRate,
int streamingChannels,
int streamingSize,
int streamingCount)
Creates a SoundStreamHead object specifying all the parameters required to define the sound. |
|
SoundStreamHead(SoundStreamHead object)
Creates and initialises a SoundStreamHead object using the values copied from another SoundStreamHead object. |
|
SoundStreamHead(SWFDecoder coder)
Creates and initialises a SoundStreamHead object using values encoded in the Flash binary format. |
|
| Method Summary | |
|---|---|
SoundStreamHead |
copy()
Creates a complete copy of this object. |
void |
encode(SWFEncoder coder,
Context context)
Encode an object to the Flash binary format. |
SoundFormat |
getFormat()
Get the compression format used. |
int |
getLatency()
For MP3 encoded sounds, returns the number of samples to skip when starting to play a sound. |
int |
getPlayChannels()
Get the recommended number of playback channels = 1 = mono 2 = stereo. |
int |
getPlayRate()
Returns the recommended playback rate: 5512, 11025, 22050 or 44100 Hz. |
int |
getPlaySampleSize()
Get the recommended playback sample range in bytes: 1 or 2. |
int |
getStreamChannels()
Get the number of channels, 1 = mono 2 = stereo, in the streaming sound. |
float |
getStreamRate()
Get the sample rate: 5512, 11025, 22050 or 44100 Hz in the streaming sound. |
int |
getStreamSampleCount()
Get the average number of samples in each stream block following. |
int |
getStreamSampleSize()
Get the sample size in bytes: 1 or 2 in the streaming sound. |
int |
prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. |
void |
setFormat(SoundFormat encoding)
Sets the format for the streaming sound. |
void |
setLatency(int delay)
Set the number of samples to skip when starting to play an MP3 encoded sound. |
void |
setPlayChannels(int channels)
Sets the recommended number of playback channels = 1 = mono 2 = stereo. |
void |
setPlayRate(int rate)
Sets the recommended playback rate in Hz. |
void |
setPlaySampleSize(int playSize)
Sets the recommended playback sample size in bytes. |
void |
setStreamChannels(int channels)
Sets the number of channels in the streaming sound: 1 = mono 2 = stereo. |
void |
setStreamRate(int rate)
Sets the sample rate in Hz for the streaming sound. |
void |
setStreamSampleCount(int count)
Sets the number of samples in each stream block. |
void |
setStreamSampleSize(int size)
Sets the sample size in bytes for the streaming sound. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SoundStreamHead(SWFDecoder coder)
throws IOException
coder - an SWFDecoder object that contains the encoded Flash data.
IOException - if an error occurs while decoding the data.
public SoundStreamHead(int playbackRate,
int playbackChannels,
int playSize,
int streamingRate,
int streamingChannels,
int streamingSize,
int streamingCount)
playbackRate - the recommended rate for playing the sound, either 5512,
11025, 22050 or 44100 Hz.playbackChannels - The recommended number of playback channels: 1 = mono or 2 =
stereo.playSize - the recommended uncompressed sample size for playing the
sound, either 1 or 2 bytes.streamingRate - the rate at which the sound was sampled, either 5512, 11025,
22050 or 44100 Hz.streamingChannels - the number of channels: 1 = mono or 2 = stereo.streamingSize - the sample size for the sound in bytes, either 1 or 2.streamingCount - the number of samples in each subsequent SoundStreamBlock
object.public SoundStreamHead(SoundStreamHead object)
object - a SoundStreamHead object from which the values will be
copied.| Method Detail |
|---|
public SoundFormat getFormat()
public void setFormat(SoundFormat encoding)
encoding - the compression format for the sound data, must be either
ADPCM or MP3 from SoundFormat.public int getPlayRate()
public int getPlayChannels()
public int getPlaySampleSize()
public float getStreamRate()
public int getStreamChannels()
public int getStreamSampleSize()
public int getStreamSampleCount()
public void setPlayRate(int rate)
rate - the recommended rate for playing the sound.public void setPlayChannels(int channels)
channels - the recommended number of playback channels.public void setPlaySampleSize(int playSize)
playSize - the recommended sample size for playing the sound.public void setStreamRate(int rate)
rate - the rate at which the streaming sound was sampled.public void setStreamChannels(int channels)
channels - the number of channels in the streaming sound.public void setStreamSampleSize(int size)
size - the sample size for the sound.public void setStreamSampleCount(int count)
count - the number of samples in each subsequent SoundStreamBlock
object.public int getLatency()
public void setLatency(int delay)
delay - the number of samples to be skipped in an MP3 encoded sound
should be 0 for other sound formats.public SoundStreamHead copy()
copy in interface Copyable<MovieTag>public String toString()
toString in class Objectpublic int prepareToEncode(Context context)
prepareToEncode in interface SWFEncodeablecontext - an Context that allows information to be passed between
objects to control how they are initialised for encoding.
public void encode(SWFEncoder coder,
Context context)
throws IOException
encode in interface SWFEncodeablecoder - an SWFEncoder object.context - an Context that allows information to be passed between
objects to control how they are initialised for encoding.
IOException - if an error occurs while encoding the object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||