C# Class SwfDotNet.IO.Tags.DefineSoundTag

DefineSoundTag 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:

  • The DefineSoundTag object that contains the sampled sound.
  • A SoundInfo object that defines how the sound fades in and out, whether it repeats and also defines an envelope for more sophisticated control over how the sound is played
  • A StartSoundTag object that signals the Flash Player to begin playing the sound.

Five encoded formats for the sound data are supported:

  • NATIVE_PCM - uncompressed Pulse Code Modulated: samples are either 1 or 2 bytes. For two-byte samples the byte order is dependent on the platform on which the Flash Player is hosted. Sounds created on a platform which supports big-endian byte order will not be played correctly when listened to on a platform which supports little-endian byte order.
  • PCM - uncompressed Pulse Code Modulated: samples are either 1 or 2 bytes with the latter presented in Little-Endian byte order. This ensures that sounds can be played across different platforms.
  • ADPCM - compressed ADaptive Pulse Code Modulated: samples are encoded and compressed by comparing the difference between successive sound sample which dramatically reduces the size of the encoded sound when compared to the uncompressed PCM formats. Use this format whenever possible.
  • MP3 - compressed MPEG Audio Layer-3.
  • NELLYMOSER - compressed Nellymoser Asao format supporting low bit-rate sound for improving synchronisation between the sound and frame rate of movies.

This tag was introduced in Flash 1. Flash 3 added support for MP3 and the Nellymoser Asao format was added in Flash 6.

Inheritance: BaseTag, DefineTag
Mostrar archivo Open project: bladecoding/SwfExport Class Usage Examples

Public Methods

Method Description
DecompileToFile ( string fileName ) : void

Decompiles to file.

DefineSoundTag ( ) : System

Creates a new DefineSoundTag instance.

DefineSoundTag ( ushort soundId, uint soundFormat, uint soundRate, uint soundSize, uint soundType, uint soundSampleCount, byte soundData ) : System

Creates a new DefineSoundTag instance.

FromFile ( ushort characterId, string fileName ) : DefineSoundTag

Construct a new DefineSoundTag object from a file. This method assigns file stream data and character Id, but not get audio file properties (as format, bitrate, etc.).

FromStream ( ushort characterId, Stream stream ) : DefineSoundTag

Construct a new DefineSoundTag object from a stream. This method assigns file stream data and character Id, but not get audio file properties (as format, bitrate, etc.).

GetSizeOf ( ) : int

Gets the size of.

ReadData ( byte version, BufferedBinaryReader binaryReader ) : void

see base class

Serialize ( XmlWriter writer ) : void

Serializes with the specified writer.

UpdateData ( byte version ) : void

see base class

Private Methods

Method Description
DecompileToStream ( Stream stream ) : void

Decompiles to stream.

Method Details

DecompileToFile() public method

Decompiles to file.
public DecompileToFile ( string fileName ) : void
fileName string Name of the file.
return void

DefineSoundTag() public method

Creates a new DefineSoundTag instance.
public DefineSoundTag ( ) : System
return System

DefineSoundTag() public method

Creates a new DefineSoundTag instance.
public DefineSoundTag ( ushort soundId, uint soundFormat, uint soundRate, uint soundSize, uint soundType, uint soundSampleCount, byte soundData ) : System
soundId ushort Sound id.
soundFormat uint Sound format.
soundRate uint Sound rate.
soundSize uint Size of the sound.
soundType uint Sound type.
soundSampleCount uint Sound sample count.
soundData byte Sound data.
return System

FromFile() public static method

Construct a new DefineSoundTag object from a file. This method assigns file stream data and character Id, but not get audio file properties (as format, bitrate, etc.).
public static FromFile ( ushort characterId, string fileName ) : DefineSoundTag
characterId ushort Character id.
fileName string Name of the file.
return DefineSoundTag

FromStream() public static method

Construct a new DefineSoundTag object from a stream. This method assigns file stream data and character Id, but not get audio file properties (as format, bitrate, etc.).
public static FromStream ( ushort characterId, Stream stream ) : DefineSoundTag
characterId ushort Character id.
stream Stream Stream.
return DefineSoundTag

GetSizeOf() public method

Gets the size of.
public GetSizeOf ( ) : int
return int

ReadData() public method

see base class
public ReadData ( byte version, BufferedBinaryReader binaryReader ) : void
version byte
binaryReader SwfDotNet.IO.Utils.BufferedBinaryReader
return void

Serialize() public method

Serializes with the specified writer.
public Serialize ( XmlWriter writer ) : void
writer System.Xml.XmlWriter Writer.
return void

UpdateData() public method

see base class
public UpdateData ( byte version ) : void
version byte
return void