com.flagstone.transform.sound
Class SoundStreamBlock

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

public final class SoundStreamBlock
extends Object
implements MovieTag

SoundStreamBlock contains the sound data being streamed to the Flash Player.

Streaming sounds are played in tight synchronisation with one SoundStreamBlock object defining the sound for each frame displayed in a movie. When a streaming sound is played if the Flash Player cannot render the frames fast enough to maintain synchronisation with the sound being played then frames will be skipped. Normally the player will reduce the frame rate so every frame of a movie is played.

See Also:
SoundStreamHead, SoundStreamHead2

Constructor Summary
SoundStreamBlock(byte[] bytes)
          Creates a SoundStreamBlock specifying the sound data in the format defined by a preceding SoundStreamHead or SoundStreamHead2 object.
SoundStreamBlock(SoundStreamBlock object)
          Creates and initialises a SoundStreamBlock object using the values copied from another SoundStreamBlock object.
SoundStreamBlock(SWFDecoder coder)
          Creates and initialises a SoundStreamBlock object using values encoded in the Flash binary format.
 
Method Summary
 SoundStreamBlock copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 byte[] getSound()
          Get a copy of the sound data in the format defined by a preceding SoundStreamHead or SoundStreamHead2 object.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 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

SoundStreamBlock

public SoundStreamBlock(SWFDecoder coder)
                 throws IOException
Creates and initialises a SoundStreamBlock 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.

SoundStreamBlock

public SoundStreamBlock(byte[] bytes)
Creates a SoundStreamBlock specifying the sound data in the format defined by a preceding SoundStreamHead or SoundStreamHead2 object.

Parameters:
bytes - a list of bytes containing the sound data. Must not be null.

SoundStreamBlock

public SoundStreamBlock(SoundStreamBlock object)
Creates and initialises a SoundStreamBlock object using the values copied from another SoundStreamBlock object.

Parameters:
object - a SoundStreamBlock object from which the values will be copied.
Method Detail

getSound

public byte[] getSound()
Get a copy of the sound data in the format defined by a preceding SoundStreamHead or SoundStreamHead2 object.

Returns:
a copy of the sound.

setSound

public void setSound(byte[] bytes)
Sets the sound data.

Parameters:
bytes - a list of bytes containing the sound data. Must not be null.

copy

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

Specified by:
copy in interface Copyable<MovieTag>
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.