![]() |
Gorgon Game Engine
|
Basic controller, allows non-positional playback of data buffer. More...
Public Member Functions | |
BasicController ()=default | |
Default constructor. More... | |
BasicController (const Containers::Wave &wavedata) | |
Filling constructor. More... | |
float | GetCurrentFraction () const |
Returns the fraction of the audio that is played. More... | |
float | GetCurrentTime () const |
Returns the current playback time in seconds. More... | |
float | GetDuration () const |
Returns the duration of the audio buffer in seconds. This function will return 0 if data is not set. More... | |
float | GetVolume () const |
Returns the current volume of the playback. More... | |
bool | HasData () const |
Returns whether this controller has data. More... | |
bool | IsFinished () const |
Whether the audio is finished playing. More... | |
bool | IsLooping () const |
Whether the audio is being looped. More... | |
bool | IsPlaying () const |
Whether the audio is being played right now. More... | |
BasicController & | Loop () |
Plays this sound. More... | |
BasicController & | Pause () |
Pauses the playback. More... | |
BasicController & | Play () |
Plays this sound. More... | |
void | ReleaseData () |
Releases the data being played by this controller. More... | |
BasicController & | Reset () |
Resets the playback to the beginning of the buffer. This function will not stop the playback. More... | |
BasicController & | Seek (float target) |
Changes the point of playback to the given time in seconds. More... | |
BasicController & | SeekTo (float target) |
Changes the point of playback to the given time in fraction: 1 would be the end of buffer. More... | |
void | SetData (const Containers::Wave &wavedata) |
Sets the data to be played by this controller. More... | |
BasicController & | SetVolume (float volume) |
Changes the volume of the playback. More... | |
virtual ControllerType | Type () const override |
Returns the type of the controller. More... | |
![]() | |
Controller () | |
Default constructor. More... | |
virtual | ~Controller () |
Protected Member Functions | |
virtual void | datachanged () |
Override this function to detect changes in the wave data. More... | |
Protected Attributes | |
const Containers::Wave * | wavedata |
Contains the data for this controller. More... | |
Basic controller, allows non-positional playback of data buffer.
Timing is stored in seconds.
|
default |
Default constructor.
BasicController | ( | const Containers::Wave & | wavedata | ) |
Filling constructor.
References BasicController::datachanged().
|
protectedvirtual |
Override this function to detect changes in the wave data.
It will be called if the constructor sets wavedata
float GetCurrentFraction | ( | ) | const |
Returns the fraction of the audio that is played.
References Wave::GetLength(), and BasicController::wavedata.
float GetCurrentTime | ( | ) | const |
Returns the current playback time in seconds.
float GetDuration | ( | ) | const |
Returns the duration of the audio buffer in seconds. This function will return 0 if data is not set.
References Wave::GetLength(), and BasicController::wavedata.
float GetVolume | ( | ) | const |
Returns the current volume of the playback.
bool HasData | ( | ) | const |
Returns whether this controller has data.
References BasicController::wavedata.
bool IsFinished | ( | ) | const |
Whether the audio is finished playing.
References Wave::GetLength(), and BasicController::wavedata.
bool IsLooping | ( | ) | const |
Whether the audio is being looped.
bool IsPlaying | ( | ) | const |
Whether the audio is being played right now.
BasicController & Loop | ( | ) |
Plays this sound.
When called, this function will set looping flag. If there is no wavedata associated with this controller, nothing happens until the data is set, after data is set, it starts playing immediately.
BasicController & Pause | ( | ) |
Pauses the playback.
Next time when a play or loop is called, the playback will continue from where it left off. Use Reset to start over.
BasicController & Play | ( | ) |
Plays this sound.
When called, this function will unset looping flag. If there is no wavedata associated with this controller, nothing happens until the data is set, after data is set, it starts playing immediately.
References Wave::GetLength(), and BasicController::wavedata.
void ReleaseData | ( | ) |
Releases the data being played by this controller.
References Gorgon::Audio::internal::ControllerMtx, BasicController::datachanged(), and BasicController::wavedata.
BasicController & Reset | ( | ) |
Resets the playback to the beginning of the buffer. This function will not stop the playback.
BasicController & Seek | ( | float | target | ) |
Changes the point of playback to the given time in seconds.
This function will not start or stop the playback
BasicController & SeekTo | ( | float | target | ) |
Changes the point of playback to the given time in fraction: 1 would be the end of buffer.
This function will not start or stop the playback
References Wave::GetLength(), and BasicController::wavedata.
void SetData | ( | const Containers::Wave & | wavedata | ) |
Sets the data to be played by this controller.
Timing might be percent based, thus, when an audio data is swapped with another, playback position can be moved. Additionally, if the timing is stored in seconds, swapping wavedata might cause playback to stop or loop to the start immediately.
References Gorgon::Audio::internal::ControllerMtx, BasicController::datachanged(), and BasicController::wavedata.
BasicController & SetVolume | ( | float | volume | ) |
Changes the volume of the playback.
1 would mean the volume is not modified. While its possible to use higher values, it might cause distortion in the sound.
|
overridevirtual |
|
protected |
Contains the data for this controller.