![]() |
Skylicht Engine
|
The main audio engine singleton for managing audio playback and resources. More...
#include <Engine/CAudioEngine.h>
Public Member Functions | |
| void | init () |
| Initialize the audio engine, driver, and background thread. | |
| void | shutdown () |
| Shutdown the audio engine and release all resources. | |
| void | pauseEngine () |
| Suspend the audio engine and driver. | |
| void | resumeEngine () |
| Resume the audio engine and driver. | |
| void | updateDriver () |
| Manually update the audio driver. | |
| void | stopAllSound () |
| Stop all active sounds. | |
| virtual void | updateEmitter () |
| Update all active emitters. Called by updateThread or updateSkylichtAudio. | |
| virtual void | updateThread () |
| Background thread update loop. | |
| void | lockThread () |
| Lock audio thread for safe state modification. | |
| void | unLockThread () |
| Unlock audio thread. | |
| ISoundDriver * | getSoundDriver () |
| Get the active sound driver. | |
| void | registerStreamFactory (IStreamFactory *streamFactory) |
| Register a custom stream factory. | |
| void | unRegisterStreamFactory (IStreamFactory *streamFactory) |
| Unregister a stream factory. | |
| IStream * | createStreamFromMemory (unsigned char *buffer, int size, bool takeOwnerShip=false) |
| Create an audio stream from a memory buffer. | |
| IStream * | createStreamFromFile (const char *fileName) |
| Create an audio stream from a file. | |
| IStream * | createStreamFromFileAndCache (const char *fileName, bool cache) |
| Create an audio stream from a file with optional caching. | |
| IStream * | createOnlineStream () |
| Create an empty online stream for streaming data over the network. | |
| CAudioEmitter * | createAudioEmitter (IStream *stream, IAudioDecoder::EDecoderType decode) |
| Create an audio emitter from a stream. | |
| CAudioEmitter * | createAudioEmitter (const char *fileName, bool cache) |
| Create an audio emitter from a file. | |
| CAudioEmitter * | createRawAudioEmitter (IStream *stream) |
| Create an audio emitter for raw PCM data. | |
| CAudioReader * | createAudioReader (IStream *stream, IAudioDecoder::EDecoderType decode) |
| Create an audio reader for decoding audio data without playback. | |
| CAudioReader * | createAudioReader (const char *fileName) |
| Create an audio reader from a file. | |
| void | destroyEmitter (CAudioEmitter *emitter) |
| Destroy an audio emitter. | |
| void | destroyReader (CAudioReader *reader) |
| Destroy an audio reader. | |
| void | destroyAllEmitter () |
| Destroy all audio emitters. | |
| void | destroyAllReader () |
| Destroy all audio readers. | |
| void | releaseAllStream () |
| Release all cached streams. | |
| void | setListener (float posx, float posy, float posz, float upx, float upy, float upz, float frontx, float fronty, float frontz) |
| Set the listener parameters for 3D sound. | |
| const SListener & | getListener () |
| Get current listener parameters. | |
| bool | isPause () |
| Check if the audio engine is paused. | |
| Public Member Functions inherited from Skylicht::System::IThreadCallback | |
| virtual bool | enableThreadLoop () |
| virtual void | runThread () |
Static Public Member Functions | |
| static CAudioEngine * | getSoundEngine () |
| Get the singleton instance of the audio engine. | |
| static void | shutdownEngine () |
| Shutdown and release the audio engine instance. | |
Protected Attributes | |
| IThread * | m_thread |
| IMutex * | m_mutex |
| ISoundDriver * | m_driver |
| IStreamFactory * | m_defaultStreamFactory |
| std::vector< IStreamFactory * > | m_streamFactorys |
| std::vector< CAudioEmitter * > | m_emitters |
| std::vector< CAudioReader * > | m_readers |
| std::map< std::string, IStream * > | m_fileToStream |
| SListener | m_listener |
| bool | m_pause |
The main audio engine singleton for managing audio playback and resources.
| CAudioEmitter * Skylicht::Audio::CAudioEngine::createAudioEmitter | ( | const char * | fileName, |
| bool | cache ) |
Create an audio emitter from a file.
| fileName | Path to the audio file |
| cache | If true, the file data will be cached in memory |
| CAudioEmitter * Skylicht::Audio::CAudioEngine::createAudioEmitter | ( | IStream * | stream, |
| IAudioDecoder::EDecoderType | decode ) |
Create an audio emitter from a stream.
| stream | The audio stream |
| decode | The decoder type |
| CAudioReader * Skylicht::Audio::CAudioEngine::createAudioReader | ( | const char * | fileName | ) |
Create an audio reader from a file.
| fileName | Path to the audio file |
| CAudioReader * Skylicht::Audio::CAudioEngine::createAudioReader | ( | IStream * | stream, |
| IAudioDecoder::EDecoderType | decode ) |
Create an audio reader for decoding audio data without playback.
| stream | The audio stream |
| decode | The decoder type |
| IStream * Skylicht::Audio::CAudioEngine::createOnlineStream | ( | ) |
Create an empty online stream for streaming data over the network.
| CAudioEmitter * Skylicht::Audio::CAudioEngine::createRawAudioEmitter | ( | IStream * | stream | ) |
Create an audio emitter for raw PCM data.
| stream | The PCM data stream |
| IStream * Skylicht::Audio::CAudioEngine::createStreamFromFile | ( | const char * | fileName | ) |
Create an audio stream from a file.
| fileName | Path to the audio file |
| IStream * Skylicht::Audio::CAudioEngine::createStreamFromFileAndCache | ( | const char * | fileName, |
| bool | cache ) |
Create an audio stream from a file with optional caching.
| fileName | Path to the audio file |
| cache | If true, the file data will be cached in memory |
| IStream * Skylicht::Audio::CAudioEngine::createStreamFromMemory | ( | unsigned char * | buffer, |
| int | size, | ||
| bool | takeOwnerShip = false ) |
Create an audio stream from a memory buffer.
| buffer | The memory buffer containing audio data |
| size | The size of the buffer |
| takeOwnerShip | If true, the stream will delete the buffer upon destruction |
| void Skylicht::Audio::CAudioEngine::destroyEmitter | ( | CAudioEmitter * | emitter | ) |
Destroy an audio emitter.
| emitter | The emitter to destroy |
| void Skylicht::Audio::CAudioEngine::destroyReader | ( | CAudioReader * | reader | ) |
Destroy an audio reader.
| reader | The reader to destroy |
|
inline |
Get current listener parameters.
|
inline |
Get the active sound driver.
|
static |
Get the singleton instance of the audio engine.
|
inline |
Check if the audio engine is paused.
| void Skylicht::Audio::CAudioEngine::registerStreamFactory | ( | IStreamFactory * | streamFactory | ) |
Register a custom stream factory.
| streamFactory | The factory to register |
| void Skylicht::Audio::CAudioEngine::setListener | ( | float | posx, |
| float | posy, | ||
| float | posz, | ||
| float | upx, | ||
| float | upy, | ||
| float | upz, | ||
| float | frontx, | ||
| float | fronty, | ||
| float | frontz ) |
Set the listener parameters for 3D sound.
| posx | X coordinate of the listener |
| posy | Y coordinate of the listener |
| posz | Z coordinate of the listener |
| upx | X coordinate of the up vector |
| upy | Y coordinate of the up vector |
| upz | Z coordinate of the up vector |
| frontx | X coordinate of the forward vector |
| fronty | Y coordinate of the forward vector |
| frontz | Z coordinate of the forward vector |
| void Skylicht::Audio::CAudioEngine::unRegisterStreamFactory | ( | IStreamFactory * | streamFactory | ) |
Unregister a stream factory.
| streamFactory | The factory to unregister |
|
virtual |
Background thread update loop.
Implements Skylicht::System::IThreadCallback.