#include <libsswf.h>
Inheritance diagram for sswf::SoundInfo:
Public Member Functions | |
void | AddEnvelope (const Envelope &envelope) |
This function adds one Envelope to the SoundInfo object. | |
void | NoMultiple (bool no_multiple=true) |
Whether the referenced sound can be played multiple times in parallel. | |
ErrorManager::error_code_t | PreSave (void) |
Makes sure that the sound identifier was defined. | |
void | Save (Data &data) const |
Save the information in the specified Data buffer. | |
void | SetLoop (unsigned short loop) |
Set the number of times a sound shall be played. | |
void | SetRange (unsigned long start, unsigned long end) |
The start and end points to playback. | |
void | SetSoundID (sswf_id_t id) |
Set the reference to the sound to playback. | |
SoundInfo (ErrorManager &error_manager) | |
Initializes a sound information class. | |
void | StopSound (bool stop=true) |
Whether this SoundInfo is used to stop a sound. | |
Private Attributes | |
unsigned long | f_end_position |
Vectors | f_envelopes |
ErrorManager & | f_error_manager |
unsigned short | f_loop |
bool | f_no_multiple |
sswf_id_t | f_sound_id |
unsigned long | f_start_position |
bool | f_stop |
A SoundInfo object is set in a TagStartSound object.
SoundInfo::SoundInfo | ( | ErrorManager & | error_manager | ) |
This constructor resets the SoundInfo object to defaults:
Stop the sound, the sound effect cannot be played more than once, the start and end position are 0 and end of the sound effect respectively, it loops just once and there is no envelopes by default.
[in] | error_manager | A pointer to your TagHeader (i.e. it is the error manager!) |
void SoundInfo::AddEnvelope | ( | const Envelope & | envelope | ) |
This function accepts an envelope to add to the SoundInfo.
The Envelope can be used to fade a sound in or out.
Note that a SoundInfo is limited to a maximum of 255 envelopes.
The input Envelope is duplicated in the SoundInfo.
Note that the new envelope is placed where it needs to be so as to be properly ordered by position (since version 1.8.1--in previous versions, additional envelopes would be appended so they had to be added in order.)
[in] | envelope | The envelope to add |
void SoundInfo::NoMultiple | ( | bool | no_multiple = true |
) |
This flag is used to determine whether the referenced sound can be played multiple times in parallel. In general, this flag is set to true but the default is false.
[in] | no_multiple | Whether multiple instances will play in parallel |
ErrorManager::error_code_t SoundInfo::PreSave | ( | void | ) |
This function ensures that:
void SoundInfo::Save | ( | Data & | data | ) | const |
void SoundInfo::SetLoop | ( | unsigned short | loop | ) |
This function changes the number of time a sound effect will be repeated. By default a sound effect is played just once.
[in] | loop | The number of times the sound effect shall be played |
void SoundInfo::SetRange | ( | unsigned long | start, | |
unsigned long | end | |||
) |
The SoundInfo can be used to play only a small portion of a sound effect. This function can be used to define the start and end points in the sound samples.
The start parameter must be small than the end parameter unless one or the other is set to zero. (i.e. zero represents the default; for the start zero is zero and for the end zero represents the total number of samples of the referenced sound tag.)
The position is defined in number of samples. So when set to 1 with stereo 16 bits sample, the sound starts playing at byte offset 4.
[in] | start | The start position |
[in] | end | The end position |
void SoundInfo::SetSoundID | ( | sswf_id_t | id | ) |
This function must be called with a valid identifier (i.e. an identifier to a sound effect object.)
The default value (0) is not valid. Thus you have to call this function at least once.
[in] | id | The identifier of the corresponding TagSound |
void SoundInfo::StopSound | ( | bool | stop = true |
) |
This function is used to mark a SoundInfo entry as a "Stop Button" (true) or a "Start Button" (false.)
When a sound is marked to be stopped (default), then the other parameters (except the sound identifier) are ignored.
[in] | stop | If true, stop the sound. |
unsigned long sswf::SoundInfo::f_end_position [private] |
Vectors sswf::SoundInfo::f_envelopes [private] |
ErrorManager& sswf::SoundInfo::f_error_manager [private] |
unsigned short sswf::SoundInfo::f_loop [private] |
bool sswf::SoundInfo::f_no_multiple [private] |
sswf_id_t sswf::SoundInfo::f_sound_id [private] |
unsigned long sswf::SoundInfo::f_start_position [private] |
bool sswf::SoundInfo::f_stop [private] |