#include <AudioManager.hpp>
|
| void | init () override |
| void | process () override |
| void | shutdown () override |
| void | registerAudio (std::string path, ae::q20_12_t loopStartTime, ae::q20_12_t loopEndTime) |
| | Sets up the audio track to be played.
|
| void | playAudio () |
| | Play the currently registered audio, if paused.
|
| void | pauseAudio () |
| | Pause the currently registered audio, if playing.
|
| void | stopAudio () |
| | Deregister the currently registered audio.
|
| void | registerSFX (SFX sfx) |
| | Register the SFX to be played.
|
| void | playSFX (SFX sfx, int volume, int panning) |
| | Play the specified registered SFX.
|
| void | stopSFX () |
| | Stop all currently playing SFXs.
|
| ae::q20_12_t | getDuration () |
| | Get the total duration of the audio.
|
| ae::q20_12_t | getTime () |
| | Get the current time of the audio.
|
|
| | AudioManager ()=default |
| int | getFrame () |
| | Get the current audio frame.
|
| void | seekFrame (int frame) |
| | Move to the specified audio frame.
|
| void | setLoop (ae::q20_12_t startTime, ae::q20_12_t endTime) |
| | Set the audio looping points.
|
| void | loop () |
| | Looping logic.
|
| void | rewind () |
| | Move to the start of the audio track.
|
| uint32_t | decodeFrame () |
| | Decode the current audio frame.
|
| uint32_t | decode (short *sample_data, int num_samples) |
| | Decode the given audio sample based on the current frame.
|
| mm_word | processStream (mm_word length, mm_addr dest, mm_stream_formats format) |
| | Processes the next audio data to play.
|
|
| static mm_word | audioCallback (mm_word length, mm_addr dest, mm_stream_formats format) |
| | Callback for maxmod audio streaming, acting as a wrapper for processStream.
|
Definition at line 13 of file AudioManager.hpp.
◆ AudioManager()
| AudioManager::AudioManager |
( |
| ) |
|
|
privatedefault |
◆ audioCallback()
| mm_word AudioManager::audioCallback |
( |
mm_word | length, |
|
|
mm_addr | dest, |
|
|
mm_stream_formats | format ) |
|
staticprivate |
Callback for maxmod audio streaming, acting as a wrapper for processStream.
- Parameters
-
| length | the audio word length |
| dest | the audio destination address |
| format | the audio stream format |
- Returns
- mm_word the audio data to play
Definition at line 202 of file AudioManager.cpp.
◆ decode()
| uint32_t AudioManager::decode |
( |
short * | sample_data, |
|
|
int | num_samples ) |
|
private |
Decode the given audio sample based on the current frame.
- Parameters
-
| sample_data | the sample data |
| num_samples | the number of samples |
- Returns
- uint32_t the frame length
Definition at line 164 of file AudioManager.cpp.
◆ decodeFrame()
| uint32_t AudioManager::decodeFrame |
( |
| ) |
|
|
private |
Decode the current audio frame.
- Returns
- uint32_t the number of samples
Definition at line 148 of file AudioManager.cpp.
◆ getDuration()
| ae::q20_12_t AudioManager::getDuration |
( |
| ) |
|
Get the total duration of the audio.
- Returns
- ae::q20_12_t the duration in seconds
Definition at line 42 of file AudioManager.cpp.
◆ getFrame()
| int AudioManager::getFrame |
( |
| ) |
|
|
private |
Get the current audio frame.
- Returns
- int the audio frame
Definition at line 61 of file AudioManager.cpp.
◆ getTime()
| ae::q20_12_t AudioManager::getTime |
( |
| ) |
|
Get the current time of the audio.
- Returns
- ae::q20_12_t the time in seconds
Definition at line 52 of file AudioManager.cpp.
◆ init()
| void AudioManager::init |
( |
| ) |
|
|
override |
◆ loop()
| void AudioManager::loop |
( |
| ) |
|
|
private |
◆ pauseAudio()
| void AudioManager::pauseAudio |
( |
| ) |
|
Pause the currently registered audio, if playing.
Definition at line 309 of file AudioManager.cpp.
◆ playAudio()
| void AudioManager::playAudio |
( |
| ) |
|
Play the currently registered audio, if paused.
Definition at line 304 of file AudioManager.cpp.
◆ playSFX()
| void AudioManager::playSFX |
( |
SFX | sfx, |
|
|
int | volume, |
|
|
int | panning ) |
Play the specified registered SFX.
- Parameters
-
| sfx | the SFX to play |
| volume | the volume of the SFX. Range is from 0-127 |
| panning | the direction to play the sound effect (left to right). The range is 0-127 (64 plays both left and right equally) |
Definition at line 341 of file AudioManager.cpp.
◆ process()
| void AudioManager::process |
( |
| ) |
|
|
override |
◆ processStream()
| mm_word AudioManager::processStream |
( |
mm_word | length, |
|
|
mm_addr | dest, |
|
|
mm_stream_formats | format ) |
|
private |
Processes the next audio data to play.
- Parameters
-
| length | the audio word length |
| dest | the audio destination address |
| format | the audio stream format |
- Returns
- mm_word the decoded audio data
Definition at line 207 of file AudioManager.cpp.
◆ registerAudio()
| void AudioManager::registerAudio |
( |
std::string | path, |
|
|
ae::q20_12_t | loopStartTime, |
|
|
ae::q20_12_t | loopEndTime ) |
Sets up the audio track to be played.
- Parameters
-
| path | the file path to the audio track |
| loopStartTime | the loop start time in seconds |
| loopEndTime | the loop end time in seconds |
Definition at line 225 of file AudioManager.cpp.
◆ registerSFX()
| void AudioManager::registerSFX |
( |
SFX | sfx | ) |
|
◆ rewind()
| void AudioManager::rewind |
( |
| ) |
|
|
private |
◆ seekFrame()
| void AudioManager::seekFrame |
( |
int | frame | ) |
|
|
private |
Move to the specified audio frame.
- Parameters
-
| frame | the audio frame to move to |
Definition at line 70 of file AudioManager.cpp.
◆ setLoop()
| void AudioManager::setLoop |
( |
ae::q20_12_t | startTime, |
|
|
ae::q20_12_t | endTime ) |
|
private |
Set the audio looping points.
- Parameters
-
| startTime | the loop start time in seconds |
| endTime | the loop end time in seconds |
Definition at line 95 of file AudioManager.cpp.
◆ shutdown()
| void AudioManager::shutdown |
( |
| ) |
|
|
override |
◆ stopAudio()
| void AudioManager::stopAudio |
( |
| ) |
|
◆ stopSFX()
| void AudioManager::stopSFX |
( |
| ) |
|
◆ Singleton< AudioManager >
◆ endFrame
| int AudioManager::endFrame = 0 |
|
private |
◆ isAudioRegistered
| bool AudioManager::isAudioRegistered = false |
|
private |
◆ isLoopingEnabled
| bool AudioManager::isLoopingEnabled = false |
|
private |
◆ qp
◆ startFrame
| int AudioManager::startFrame = 0 |
|
private |
The documentation for this class was generated from the following files: