AudioGeneratorVoice
A generator wired into the AudioEngine as a custom data source, so its blocks take the normal route: bus / submix, volume, and 3D spatialization when SetSpatial(true). Mirrors MetaSoundVoice. The voice keeps the generator alive until it is uninitialized, so the audio thread never holds a dangling pointer; the caller may drop its own shared_ptr at any time.
- Module
- Audio
- Header
#include "Audio/AudioGenerator.h"- Namespace
Mowo
Constructors
| Signature | Name | Description |
|---|---|---|
AudioGeneratorVoice() | AudioGeneratorVoice | |
~AudioGeneratorVoice() | ~AudioGeneratorVoice | |
AudioGeneratorVoice(const AudioGeneratorVoice&) = delete | AudioGeneratorVoice |
Public functions
| Returns | Name | Description |
|---|---|---|
AudioGeneratorVoice& | operator= | |
bool | Initialize | Attach a voice on bus rendering at the engine's sample rate. |
void | Shutdown | |
void | Play | Play posts a Start (OnStart on the next block); Stop posts a Stop (OnStop on the next block, then silence). |
void | Stop | |
bool | IsPlaying | |
void | SetVolume | |
void | SetSpatial | |
void | SetPosition | |
void | Reset | Reset applied at the start of the next block. |
std::shared_ptr<IAudioGenerator> | GetGenerator |
Function details
AudioGeneratorVoice
AudioGeneratorVoice()~AudioGeneratorVoice
~AudioGeneratorVoice()AudioGeneratorVoice
AudioGeneratorVoice(const AudioGeneratorVoice&) = deleteoperator=
AudioGeneratorVoice& operator=(const AudioGeneratorVoice&) = deleteInitialize
bool Initialize(std::shared_ptr<IAudioGenerator> generator, AudioBus bus = AudioBus::SFX, uint32_t channels = 2)Attach a voice on bus rendering at the engine's sample rate. channels is what the generator writes (1..8); the engine converts it to the mix layout. Returns false when the engine is down or the generator is null.
Shutdown
void Shutdown()Play
void Play()Play posts a Start (OnStart on the next block); Stop posts a Stop (OnStop on the next block, then silence). The voice stays attached, so Play resumes it with no re-initialization.
Stop
void Stop()IsPlaying
bool IsPlaying() constSetVolume
void SetVolume(float volume)SetSpatial
void SetSpatial(bool spatial)SetPosition
void SetPosition(float x, float y, float z)Reset
void Reset()Reset applied at the start of the next block.
GetGenerator
std::shared_ptr<IAudioGenerator> GetGenerator() const