|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.flagstone.transform.FSTransformObject
com.flagstone.transform.FSMovieObject
com.flagstone.transform.FSDefineObject
com.flagstone.transform.FSDefineSound
public class FSDefineSound
FSDefineSound is used to define a sound that will be played when a given event occurs.
Three different types of object are used to play an event sound:
An FSDefineSound object contains the following attributes:
Attributes | |
---|---|
type | Identifies the data structure when it is encoded. Read-only. |
identifier | An unique identifier for this object in the range 1..65535. |
format | The format of the sound data - FSDefineSound.NATIVE_PCM, FSDefineSound.ADPCM, FSDefineSound.MP3, FSDefineSound.PCM or FSDefineSound.NELLYMOSER |
playbackRate | The rate the sound will be played in Hertz: 5512, 11025, 22050 or 44100 |
playbackChannels | The number of channels in the sound, typically 1 (mono) or 2 (stereo). |
playbackSampleSize | The number of bytes in a sample: 1 or 2. |
sampleCount | The number of samples in the sound. |
soundLength | The number of bytes in the sound data. |
sound | The encoded sound data. |
Five encoded formats for the sound data are supported:
Constants representing the different formats are defined in the FSSound class.
The FSDefineSound class represents the DefineSound structure from the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 1. Flash 3 added support for MP3 and the Nellymoser Asao format was added in Flash 6.
Field Summary |
---|
Fields inherited from class com.flagstone.transform.FSDefineObject |
---|
identifier |
Constructor Summary | |
---|---|
FSDefineSound(FSCoder coder)
Construct an FSDefineSound object, initalising it with values decoded from an encoded object. |
|
FSDefineSound(FSDefineSound obj)
Constructs an FSDefineSound object by copying values from an existing object. |
|
FSDefineSound(int anIdentifier,
int aFormat,
int rate,
int channels,
int sampleSize,
int count,
byte[] bytes)
Constructs an FSDefineSound object specifying the unique identifier and all the parameters required to describe the sound. |
Method Summary | |
---|---|
void |
appendDescription(java.lang.StringBuffer buffer,
int depth)
AppendDescription is used to present a string description of the object including all nested objects up to a specified depth. |
java.lang.Object |
clone()
Creates a deep copy of the entire object. |
void |
decode(FSCoder coder)
|
void |
encode(FSCoder coder)
|
boolean |
equals(java.lang.Object anObject)
Returns true if anObject is equal to this one. |
int |
getFormat()
Gets the compression format used, either FSSound.NATIVE_PCM, FSSound.PCM or FSSound.ADPCM (all Flash 1), FSSound.MP3 (Flash 4+) or FSSound.NELLYMOSER (Flash 6+). |
int |
getPlaybackChannels()
Gets the number of sound channels, 1 (Mono) or 2 (Stereo). |
int |
getPlaybackRate()
Gets the rate at which the sound will be played, in Hz: 5512, 11025, 22050 or 44100. |
int |
getPlaybackSampleSize()
Gets the size of an uncompressed sample in bytes. |
int |
getSampleCount()
Gets the number of samples in the sound data. |
byte[] |
getSoundData()
Gets the sound data. |
int |
length(FSCoder coder)
|
void |
setFormat(int encoding)
Sets the compression format used, either FSSound.NATIVE_PCM, FSSound.ADPCM or FSSound.PCM from Flash 1 onwards, FSSound.MP3 from Flash 4 onwards, or FSSound.NELLYMOSER from Flash 6 onwards. |
void |
setPlaybackChannels(int channels)
Sets the number of channels defined in the sound. |
void |
setPlaybackRate(int rate)
Sets the sampling rate in Hertz. |
void |
setPlaybackSampleSize(int sampleSize)
Sets the sample size in bytes. |
void |
setSampleCount(int count)
Sets the number of samples in the sound data. |
void |
setSoundData(byte[] bytes)
Sets the sound data. |
Methods inherited from class com.flagstone.transform.FSDefineObject |
---|
getIdentifier, setIdentifier |
Methods inherited from class com.flagstone.transform.FSMovieObject |
---|
getType |
Methods inherited from class com.flagstone.transform.FSTransformObject |
---|
name, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FSDefineSound(FSCoder coder)
coder
- an FSCoder containing the binary data.public FSDefineSound(int anIdentifier, int aFormat, int rate, int channels, int sampleSize, int count, byte[] bytes)
anIdentifier
- the unique identifier for this sound.aFormat
- the encoding format for the sound. For Flash 1 the formats may
be FSSound.NATIVE_PCM, FSSound.PCM or FSSound.ADPCM. For Flash
4 or later include FSSound.MP3 and Flash 6 or later include
FSSound.NELLYMOSER.rate
- the number of samples per second that the sound is played at ,
either 5512, 11025, 22050 or 44100.channels
- the number of channels in the sound, either 1 (Mono) or 2
(Stereo).sampleSize
- the size of an uncompressed sound sample in bits, either 8 or
16.count
- the number of samples in the sound data.bytes
- the sound data.public FSDefineSound(FSDefineSound obj)
obj
- an FSDefineSound object.Method Detail |
---|
public int getFormat()
public int getPlaybackRate()
public int getPlaybackChannels()
public int getPlaybackSampleSize()
public int getSampleCount()
public byte[] getSoundData()
public void setFormat(int encoding)
encoding
- the format for the sound.public void setPlaybackRate(int rate)
rate
- the rate at which the sounds is played in Hz.public void setPlaybackChannels(int channels)
channels
- the number of channels in the sound, either 1 (Mono) or 2
(Stereo).public void setPlaybackSampleSize(int sampleSize)
sampleSize
- the size of sound samples in bytes.public void setSampleCount(int count)
count
- the number of samples for the sound.public void setSoundData(byte[] bytes)
bytes
- the sound data.public java.lang.Object clone()
FSTransformObject
clone
in class FSTransformObject
public boolean equals(java.lang.Object anObject)
FSMovieObject
equals
in class FSMovieObject
public void appendDescription(java.lang.StringBuffer buffer, int depth)
FSTransformObject
appendDescription
in class FSDefineObject
buffer
- a StringBuffer to which the description of each object is
appended.depth
- the maximum level of nesting up to which objects will be
displayed.public int length(FSCoder coder)
length
in class FSDefineObject
public void encode(FSCoder coder)
encode
in class FSDefineObject
public void decode(FSCoder coder)
decode
in class FSDefineObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |