com.flagstone.transform.sound
Class Envelope

java.lang.Object
  extended by com.flagstone.transform.sound.Envelope
All Implemented Interfaces:
Copyable<Envelope>, SWFEncodeable

public final class Envelope
extends Object
implements SWFEncodeable, Copyable<Envelope>

Envelope is a container class for Level objects that describe how the volume of a sound changes over time.


Nested Class Summary
 class Envelope.Level
          Level describes the sound levels for stereo sound.
 
Constructor Summary
Envelope(Envelope object)
          Creates and initialises an Envelope object using the values copied from another Envelope object.
Envelope(SWFDecoder coder)
          Creates and initialises an Envelope object using values encoded in the Flash binary format.
 
Method Summary
 Envelope add(Envelope.Level level)
          Add a Envelope object to the list of envelope objects.
 Envelope copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 List<Envelope.Level> getLevels()
          Get the list of Levels that control the volume of the sound.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 void setLevels(List<Envelope.Level> list)
          Sets the list of Levels that define the levels at which a sound is played over the duration of the sound.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Envelope

public Envelope(SWFDecoder coder)
         throws IOException
Creates and initialises an Envelope object using values encoded in the Flash binary format.

Parameters:
coder - an SWFDecoder object that contains the encoded Flash data.
Throws:
IOException - if an error occurs while decoding the data.

Envelope

public Envelope(Envelope object)
Creates and initialises an Envelope object using the values copied from another Envelope object.

Parameters:
object - an Envelope object from which the values will be copied.
Method Detail

add

public Envelope add(Envelope.Level level)
Add a Envelope object to the list of envelope objects.

Parameters:
level - a SoundLevel object. Must not be null.
Returns:
this object.

getLevels

public List<Envelope.Level> getLevels()
Get the list of Levels that control the volume of the sound.

Returns:
the Levels that define the envelope.

setLevels

public void setLevels(List<Envelope.Level> list)
Sets the list of Levels 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.

Parameters:
list - a list of Envelope objects. Must not be null.

copy

public Envelope copy()
Creates a complete copy of this object.

Specified by:
copy in interface Copyable<Envelope>
Returns:
a deep-copy of this object. New instances of mutable objects are copied and immutable instances are shared.

toString

public String toString()
Overrides:
toString in class Object

prepareToEncode

public int prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. This method also used to initialise variables, such as offsets and flags that will be used when the object is encoded. Generally the method returns the size in bytes, however when called on objects that use bit fields such as shapes the methods will return the size in bits.

Specified by:
prepareToEncode in interface SWFEncodeable
Parameters:
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Returns:
the size of the object when it is encoded.

encode

public void encode(SWFEncoder coder,
                   Context context)
            throws IOException
Encode an object to the Flash binary format.

Specified by:
encode in interface SWFEncodeable
Parameters:
coder - an SWFEncoder object.
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Throws:
IOException - if an error occurs while encoding the object.


Copyright © 2002-2010 Flagstone Software Ltd.. All Rights Reserved.