|
|||||||||
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.FSSound
public class FSSound
The FSSound class identifies a sound (previously defined using The FSDefineSound class) and controls how it is played.
FSSound 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.
Attributes | |
---|---|
identifier | The identifier, in the range 1..65535, of the FSDefineSound object that contains the sound data. |
mode | Controls how the sound is played, either: Start - start playing the sound, Continue - start playing the sound if it is not already playing and Stop - stop playing the sound. |
inPoint | The sample number that the sound increases in volume to until full volume is reached. Optional. Set to 0 if the sound does not fade in. |
outPoint | The sample number at which the that the sound starts to fades until the sound has finished playing. Optional. Set to 0 if the sound does not fade out. |
loopCount | The number of times the sound is repeated. Optional. Must be at least 1 if a sound is being played. Set to 0 if a sound is being stopped. |
envelopes | An array of FSEnvelope objects that control how the sound is played. Optional. May be set to null or an empty array if no envelope is defined. |
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 array may be left empty if no envelope is defined for the sound. The class provides different constructors to specify different sets of attributes.
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.
The FSSound class is based on the SoundInfo data structure from the Macromedia Flash (SWF) File Format Specification. However it also contains the identifier for the sound which is a separate attribute in the data structures defined in the specification that contain SoundInfo data.
Field Summary | |
---|---|
static int |
ADPCM
Identifies an adaptive pulse code modulated sound. |
static int |
Continue
Start playing the sound or continues if it is already playing. |
static int |
MP3
Identifies an MP3 format sound. |
static int |
NATIVE_PCM
Identifies an uncompressed pulse code modulated sound. |
static int |
NELLYMOSER
|
static int |
PCM
Identifies an uncompressed pulse code modulated sound, little-endian byte order. |
static int |
Start
Start playing the sound. |
static int |
Stop
Stop playing the sound. |
Constructor Summary | |
---|---|
FSSound(FSCoder coder)
Construct an FSSound object, initalizing it with values decoded from an encoded object. |
|
FSSound(FSSound obj)
Constructs an FSSound object by copying values from an existing object. |
|
FSSound(int anIdentifier,
int aMode)
Constructs an FSSound object specifying how the sound is played. |
|
FSSound(int anIdentifier,
int aMode,
int aCount)
Constructs and FSSound object specifying how the sound is played and the number of times the sound is repeated. |
|
FSSound(int anIdentifier,
int aMode,
int anInPoint,
int anOutPoint)
Constructs and FSSound object specifying how the sound is played and the points at which the sound fades in and out. |
|
FSSound(int anIdentifier,
int aMode,
int anInPoint,
int anOutPoint,
int aCount)
Constructs and FSSound object specifying how the sound is played, the point at which the sound fades in and out and the number of times the sound is repeated. |
|
FSSound(int anIdentifier,
int aMode,
int anInPoint,
int anOutPoint,
int aCount,
java.util.ArrayList anArray)
Constructs and FSSound object specifying how the sound is played, the point at which the sound fades in and out, the number of times the sound is repeated and the envelopes used to control how the sound is played. |
Method Summary | |
---|---|
void |
add(FSEnvelope anEnvelope)
Add a FSEnvelope object to the array of envelope objects. |
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. |
java.util.ArrayList |
getEnvelopes()
Gets the array of FSEnvelope objects that control the levels the sound is played. |
int |
getIdentifier()
Gets the identifier of the sound to the played. |
int |
getInPoint()
Gets the sample number at which the sound reaches full volume when fading in. |
int |
getLoopCount()
Gets the number of times the sound will be repeated. |
int |
getMode()
Gets the synchronisation mode: SyncNoMultiple - do not play the sound if it is already playing and SyncStop - stop playing the sound. |
int |
getOutPoint()
Gets the sample number at which the sound starts to fade. |
int |
length(FSCoder coder)
|
void |
setEnvelopes(java.util.ArrayList anArray)
Sets the array of FSEnvelope objects that define the levels at which a sound is played over the duration of the sound. |
void |
setIdentifier(int anIdentifier)
Sets the identifier of the sound to the played. |
void |
setInPoint(int aNumber)
Sets the sample number at which the sound reaches full volume when fading in. |
void |
setLoopCount(int aNumber)
Sets the number of times the sound is repeated. |
void |
setMode(int aMode)
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(int aNumber)
Sets the sample number at which the sound starts to fade. |
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 |
Field Detail |
---|
public static final int NATIVE_PCM
public static final int ADPCM
public static final int MP3
public static final int PCM
public static final int NELLYMOSER
public static final int Start
public static final int Continue
public static final int Stop
Constructor Detail |
---|
public FSSound(FSCoder coder)
coder
- an FSCoder containing the binary data.public FSSound(int anIdentifier, int aMode)
anIdentifier
- the unique identifier of the object that contains the sound
data.aMode
- 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.public FSSound(int anIdentifier, int aMode, int aCount)
anIdentifier
- 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.public FSSound(int anIdentifier, int aMode, int anInPoint, int anOutPoint)
anIdentifier
- 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.anInPoint
- the sample number which the sound fades in to. May be set to
zero if the sound does not fade in.anOutPoint
- the sample number at which the sound starts to fade. May be
set to zero if the sound does not fade out.public FSSound(int anIdentifier, int aMode, int anInPoint, int anOutPoint, int aCount)
anIdentifier
- 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.anInPoint
- the sample number which the sound fades in to. May be set to
zero if the sound does not fade in.anOutPoint
- the sample number at which the sound starts to fade. May be
set to zero if the sound does not fade out.aCount
- the number of times the sound is repeated. May be set to zero
if the sound will not be repeated.public FSSound(int anIdentifier, int aMode, int anInPoint, int anOutPoint, int aCount, java.util.ArrayList anArray)
anIdentifier
- 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.anInPoint
- the sample number which the sound fades in to. May be set to
zero if the sound does not fade in.anOutPoint
- the sample number at which the sound starts to fade. May be
set to zero if the sound does not fade out.aCount
- the number of times the sound is repeated. May be set to zero
if the sound will not be repeated.anArray
- an array of FSEnvelope objects that define the levels at which
a sound is played over the duration of the sound. May be set
to NULL if no envelope is defined.public FSSound(FSSound obj)
obj
- an FSSound object.Method Detail |
---|
public void add(FSEnvelope anEnvelope)
anEnvelope
- an FSEnvelope object.public int getIdentifier()
public int getMode()
public int getInPoint()
public int getOutPoint()
public int getLoopCount()
public java.util.ArrayList getEnvelopes()
public void setIdentifier(int anIdentifier)
anIdentifier
- the identifier for the sound to be played.public void setMode(int aMode)
aMode
- how the sound is played.public void setInPoint(int aNumber)
aNumber
- the sample number which the sound fades in to.public void setOutPoint(int aNumber)
aNumber
- the sample number at which the sound starts to fade.public void setLoopCount(int aNumber)
aNumber
- the number of times the sound is repeated.public void setEnvelopes(java.util.ArrayList anArray)
anArray
- an array of FSEnvelope objects.public java.lang.Object clone()
FSTransformObject
clone
in class FSTransformObject
public boolean equals(java.lang.Object anObject)
FSTransformObject
equals
in class FSTransformObject
public void appendDescription(java.lang.StringBuffer buffer, int depth)
FSTransformObject
appendDescription
in class FSTransformObject
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 FSTransformObject
public void encode(FSCoder coder)
encode
in class FSTransformObject
public void decode(FSCoder coder)
decode
in class FSTransformObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |