|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.flagstone.transform.sound.DefineSound
public final class DefineSound
DefineSound 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:
Five encoded formats for the sound data are supported: NATIVE_PCM, PCM, ADPCM, MP3 and NELLYMOSER.
SoundInfo,
StartSound| Constructor Summary | |
|---|---|
DefineSound(DefineSound object)
Creates and initialises a DefineSound object using the values copied from another DefineSound object. |
|
DefineSound(int uid,
SoundFormat aFormat,
int playbackRate,
int channels,
int size,
int count,
byte[] bytes)
Creates a DefineSound object specifying the unique identifier and all the parameters required to describe the sound. |
|
DefineSound(SWFDecoder coder)
Creates and initialises a DefineSound object using values encoded in the Flash binary format. |
|
| Method Summary | |
|---|---|
DefineSound |
copy()
Creates a complete copy of this object. |
void |
encode(SWFEncoder coder,
Context context)
Encode an object to the Flash binary format. |
int |
getChannelCount()
Get the number of sound channels, 1 (Mono) or 2 (Stereo). |
SoundFormat |
getFormat()
Get the compression format used. |
int |
getIdentifier()
Get the unique identifier assigned to this object. |
int |
getRate()
Get the rate at which the sound will be played, in Hz: 5512, 11025, 22050 or 44100. |
int |
getSampleCount()
Get the number of samples in the sound data. |
int |
getSampleSize()
Get the size of an uncompressed sample in bytes. |
byte[] |
getSound()
Get a copy of the sound data. |
int |
prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. |
void |
setChannelCount(int channels)
Sets the number of channels defined in the sound. |
void |
setFormat(SoundFormat encoding)
Sets the compression format used. |
void |
setIdentifier(int uid)
Sets the unique identifier for an object within a given Movie. |
void |
setRate(int samplingRate)
Sets the sampling rate in Hertz. |
void |
setSampleCount(int count)
Sets the number of samples in the sound data. |
void |
setSampleSize(int size)
Sets the sample size in bytes. |
void |
setSound(byte[] bytes)
Sets the sound data. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DefineSound(SWFDecoder coder)
throws IOException
coder - an SWFDecoder object that contains the encoded Flash data.
IOException - if an error occurs while decoding the data.
public DefineSound(int uid,
SoundFormat aFormat,
int playbackRate,
int channels,
int size,
int count,
byte[] bytes)
uid - the unique identifier for this sound. Must be in the range
1..65535.aFormat - the encoding format for the sound. For Flash 1 the formats may
be one of the format: NATIVE_PCM, PCM or ADPCM. For Flash 4 or
later include MP3 and Flash 6 or later include NELLYMOSER.playbackRate - 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, must be either 1 (Mono)
or 2 (Stereo).size - the size of an uncompressed sound sample in bits, must be
either 8 or 16.count - the number of samples in the sound data.bytes - the sound data.public DefineSound(DefineSound object)
object - a DefineSound object from which the values will be
copied.| Method Detail |
|---|
public int getIdentifier()
getIdentifier in interface DefineTagpublic void setIdentifier(int uid)
setIdentifier in interface DefineTaguid - a unique identifier for the object. Must be in the range
1..65535.public SoundFormat getFormat()
public int getRate()
public int getChannelCount()
public int getSampleSize()
public int getSampleCount()
public byte[] getSound()
public void setFormat(SoundFormat encoding)
encoding - the format for the sound.public void setRate(int samplingRate)
samplingRate - the rate at which the sounds is played in Hz. Must be one of:
SoundRate.KHZ_5K, SoundRate.KHZ_11K, SoundRate.KHZ_22K or
SoundRate.KHZ_44K.public void setChannelCount(int channels)
channels - the number of channels in the sound, must be either 1 (Mono)
or 2 (Stereo).public void setSampleSize(int size)
size - the size of sound samples in bytes. Must be either 1 or 2.public void setSampleCount(int count)
count - the number of samples for the sound.public void setSound(byte[] bytes)
bytes - the sound data. Must not be null.public DefineSound 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 | |||||||||