|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.flagstone.transform.sound.SoundInfo
public final class SoundInfo
SoundInfo identifies a sound (previously defined using The DefineSound class) and controls how it is played.
SoundInfo defines how the sound fades in and out, whether it is repeated as well as specifying an envelope that provides a finer degree of control over the levels at which the sound is played.
The in and out point specify the sample number which marks the point in time at which the sound stops increasing or starts decreasing in volume respectively. Sounds are played by the Flash player at 44.1KHz so the sample number also indicates the time when the total number of samples in the sound is taken into account.
Not all the attributes are required to play a sound. Only the identifier and the mode is required. The other attributes are optional and may be added as a greater degree of control is required. The inPoint and outPoint attributes may be set to zero if the sound does not fade in or out respectively. The loopCount may be set to zero if a sound is being stopped. The envelopes may be left empty if no envelope is defined for the sound. The class provides different constructors to specify different sets of attributes.
DefineSound| Nested Class Summary | |
|---|---|
static class |
SoundInfo.Mode
Mode describes how the sound is controlled. |
| Constructor Summary | |
|---|---|
SoundInfo(int uid,
SoundInfo.Mode aMode,
int aCount,
Envelope anEnvelope)
Creates a Sound object specifying how the sound is played and the number of times the sound is repeated. |
|
SoundInfo(int uid,
SWFDecoder coder)
Creates and initialises a SoundInfo object using values encoded in the Flash binary format. |
|
SoundInfo(SoundInfo object)
Creates and initialises a SoundInfo object using the values copied from another SoundInfo object. |
|
| Method Summary | |
|---|---|
SoundInfo |
copy()
Creates a complete copy of this object. |
void |
encode(SWFEncoder coder,
Context context)
Encode an object to the Flash binary format. |
Envelope |
getEnvelope()
Get the Envelope that control the levels the sound is played. |
int |
getIdentifier()
Get the identifier of the sound to the played. |
Integer |
getInPoint()
Get the sample number at which the sound reaches full volume when fading in. |
Integer |
getLoopCount()
Get the number of times the sound will be repeated. |
SoundInfo.Mode |
getMode()
Get the synchronisation mode: START - start playing the sound, CONTINUE - do not play the sound if it is already playing and STOP - stop playing the sound. |
Integer |
getOutPoint()
Get the sample number at which the sound starts to fade. |
int |
prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. |
void |
setEnvelope(Envelope anEnvelope)
Sets the Envelope that define the levels at which a sound is played over the duration of the sound. |
void |
setIdentifier(int uid)
Sets the identifier of the sound to the played. |
void |
setInPoint(Integer aNumber)
Sets the sample number at which the sound reaches full volume when fading in. |
void |
setLoopCount(Integer aNumber)
Sets the number of times the sound is repeated. |
void |
setMode(SoundInfo.Mode soundMode)
Sets how the sound is synchronised when the frames are displayed: START - start playing the sound, CONTINUE - do not play the sound if it is already playing and STOP - stop playing the sound. |
void |
setOutPoint(Integer aNumber)
Sets the sample number at which the sound starts to fade. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SoundInfo(int uid,
SWFDecoder coder)
throws IOException
uid - the unique identifier for the sound definition - decoded by
the parent object.coder - an SWFDecoder object that contains the encoded Flash data.
IOException - if an error occurs while decoding the data.
public SoundInfo(int uid,
SoundInfo.Mode aMode,
int aCount,
Envelope anEnvelope)
uid - the unique identifier of the object that contains the sound
data.aMode - how the sound is synchronised when the frames are displayed:
Play - do not play the sound if it is already playing and Stop
- stop playing the sound.aCount - the number of times the sound is repeated. May be set to zero
if the sound will not be repeated.anEnvelope - the Envelope that control the levels the sound is played.public SoundInfo(SoundInfo object)
object - a SoundInfo object from which the values will be
copied.| Method Detail |
|---|
public int getIdentifier()
public SoundInfo.Mode getMode()
public Integer getInPoint()
public Integer getOutPoint()
public Integer getLoopCount()
public Envelope getEnvelope()
public void setIdentifier(int uid)
uid - the identifier for the sound to be played. Must be in the
range 1..65535.public void setMode(SoundInfo.Mode soundMode)
soundMode - how the sound is played.public void setInPoint(Integer aNumber)
aNumber - the sample number which the sound fades in to.public void setOutPoint(Integer aNumber)
aNumber - the sample number at which the sound starts to fade.public void setLoopCount(Integer aNumber)
aNumber - the number of times the sound is repeated.public void setEnvelope(Envelope anEnvelope)
anEnvelope - an Envelope object.public SoundInfo copy()
copy in interface Copyable<SoundInfo>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 | |||||||||