#include <libsswf.h>
Inheritance diagram for sswf::Envelope:
Public Member Functions | |
Envelope (const Envelope &envelope) | |
Copy an envelope in another one. | |
Envelope (unsigned long p, unsigned short l, unsigned short r) | |
Initializes an envelope. | |
unsigned short | Left (void) const |
Retrieve the volume for the left side. | |
unsigned long | Position (void) const |
Retrieve the position of this envelope. | |
unsigned short | Right (void) const |
Retrieve the volume for the right side. | |
void | Save (Data &data) const |
Save an envelope in a Data buffer. | |
Private Attributes | |
unsigned short | f_left |
unsigned long | f_position |
unsigned short | f_right |
This is useful if you have several places where you want to place the same sound at different volume levels.
Envelope::Envelope | ( | unsigned long | p, | |
unsigned short | l, | |||
unsigned short | r | |||
) |
The constructor initializes an envelope with a position and the volume on the left and right sides. If the sound is not stereo, the volume of both sides should be set to the same value.
The left and right volumes go from 0 (mute) to 32768 (max. power). The effect of using values outside this range is undefined.
The position is always defined as if the rate of the sound was 44,100k. So you need to multiply all positions by some value to obtain the correct envelope position.
So, if the rate of the sound is defined a R, the factor you need to use is:
44,100 / rate
In other words:
rate factor 5,512 8 11,025 4 22,050 2 44,100 1
Also, positions need to be defined between the start and stop positions of the corresponding sswf::SoundInfo (see the sswf::SoundInfo::SetRange(unsigned long start, unsigned long end) function.)
Note that the volume is clamped to the range 0 to 32768.
[in] | p | The position where the new volume applies |
[in] | l | The volume on the left side (0 to 32768) |
[in] | r | The volume on the left side (0 to 32768) |
Envelope::Envelope | ( | const Envelope & | envelope | ) |
This function can be used to copy an envelope in another.
unsigned short Envelope::Left | ( | void | ) | const |
This function returns the volume for the left side.
unsigned long Envelope::Position | ( | void | ) | const |
This function returns the position of the this envelope.
unsigned short Envelope::Right | ( | void | ) | const |
This function returns the volume for the right side.
void Envelope::Save | ( | Data & | data | ) | const |
This function is used to save an envelope as the SWF player expects. It saves the position, left and then right volumes.
[in] | data | The Data buffer where the envelope is to be saved |
unsigned short sswf::Envelope::f_left [private] |
unsigned long sswf::Envelope::f_position [private] |
unsigned short sswf::Envelope::f_right [private] |