|
VAE - Virtual Audio Engine 1
Small Data Driven Audio Engine
|
Interface for audio devices. More...
#include <vae_device.hpp>
Classes | |
| struct | AudioThreadWorker |
| Data shared with audio thread. More... | |
Public Types | |
| using | Resampler = tklb::ResamplerTpl< Sample, ScratchBuffer > |
Public Member Functions | |
| Device (Backend &backend, const EngineConfig &config) | |
| Only a Backend can construct a Device. More... | |
| virtual | ~Device () |
| void | setCallback (Callback callback) |
| virtual bool | openDevice (DeviceInfo &device)=0 |
| Opens a specific audio device. More... | |
| virtual bool | openDevice (bool input=false) |
| Tries to open the default audio device whith desired in out channels. More... | |
| virtual bool | closeDevice ()=0 |
| Closes the currently open device. More... | |
| Size | push (const ScratchBuffer &buffer) |
| Push samples to the audio device. More... | |
| Size | canPush () const |
| Return amount of audio frames which can be pushed in buffer ! this is an estimate when resampling ! More... | |
| void | pop (ScratchBuffer &buffer) |
| Get samples form audio device. More... | |
| Size | canPop () const |
| Size | getChannelsOut () const |
| Size | getChannelsIn () const |
| Size | getSampleRate () const |
| Get the sample rate. More... | |
| Size | getRealSampleRate () const |
| Get the Real Sample Rate before resampling. More... | |
| size_t | getStreamTime () const |
| Size | getOverruns () const |
| Size | getUnderruns () const |
Protected Types | |
| using | Callback = tklb::Delegate< void(Device *)> |
Protected Member Functions | |
| void | init (Size sampleRate, Uchar channelsIn, Uchar channelsOut, Size bufferSize) |
| initializes buffers, queues and resamplers if needed Has to be called in openDevice once the samplerate and channel config is known More... | |
| void | postInit () |
Protected Attributes | |
| Backend & | mBackend |
| const EngineConfig & | mConfig |
| Size | mSampleRate = 0 |
| Size | mRealSampleRate = 0 |
| Size | mOverruns = 0 |
| Size | mUnderruns = 0 |
| Resampler | mResamplerToDevice |
| ScratchBuffer | mResamplerBufferToDevice |
| AudioThreadWorker | mWorker |
Static Protected Attributes | |
| static constexpr int | _VAE_WORKER_SIZE = sizeof(AudioThreadWorker) |
Interface for audio devices.
Default implementation for resampling already provided.
Definition at line 18 of file vae_device.hpp.
|
protected |
Definition at line 25 of file vae_device.hpp.
Definition at line 20 of file vae_device.hpp.
|
inline |
|
inlinevirtual |
Definition at line 188 of file vae_device.hpp.
|
inline |
Definition at line 278 of file vae_device.hpp.
|
inline |
Return amount of audio frames which can be pushed in buffer ! this is an estimate when resampling !
Definition at line 254 of file vae_device.hpp.
|
pure virtual |
Closes the currently open device.
Otherwise does nothing.
Implemented in vae::core::DeviceDummy, vae::core::DevicePortaudio, and vae::core::DeviceRtaudio.
|
inline |
Definition at line 284 of file vae_device.hpp.
|
inline |
Definition at line 282 of file vae_device.hpp.
|
inline |
Definition at line 301 of file vae_device.hpp.
|
inline |
Get the Real Sample Rate before resampling.
Definition at line 297 of file vae_device.hpp.
|
inline |
Get the sample rate.
Definition at line 290 of file vae_device.hpp.
|
inline |
Definition at line 299 of file vae_device.hpp.
|
inline |
Definition at line 302 of file vae_device.hpp.
|
inlineprotected |
initializes buffers, queues and resamplers if needed Has to be called in openDevice once the samplerate and channel config is known
| sampleRate | The actual samplerate the device has, might not match requested rate |
| channelsIn | The real channelcount, might not match requested |
| channelsOut | The real channelcount, might not match requested |
| bufferSize | The amount of frames a callback will provide/request |
Definition at line 114 of file vae_device.hpp.
|
inlinevirtual |
Tries to open the default audio device whith desired in out channels.
Reimplemented in vae::core::DeviceDummy.
Definition at line 212 of file vae_device.hpp.
|
pure virtual |
Opens a specific audio device.
The device struct may be altered to match the actual hardware. (sampleRate, bufferSize and channel count)
Implemented in vae::core::DeviceDummy, vae::core::DevicePortaudio, and vae::core::DeviceRtaudio.
|
inline |
Get samples form audio device.
| buffer | Gets the amount of valid samples, might actualy get less |
Definition at line 267 of file vae_device.hpp.
|
inlineprotected |
Definition at line 171 of file vae_device.hpp.
|
inline |
Push samples to the audio device.
| buffer | Pushes the amount of valid samples |
Definition at line 228 of file vae_device.hpp.
|
inline |
|
staticconstexprprotected |
Definition at line 100 of file vae_device.hpp.
|
protected |
Definition at line 23 of file vae_device.hpp.
|
protected |
Definition at line 24 of file vae_device.hpp.
|
protected |
Definition at line 28 of file vae_device.hpp.
|
protected |
Definition at line 27 of file vae_device.hpp.
|
protected |
Definition at line 32 of file vae_device.hpp.
|
protected |
Definition at line 31 of file vae_device.hpp.
|
protected |
Definition at line 26 of file vae_device.hpp.
|
protected |
Definition at line 29 of file vae_device.hpp.
|
protected |
Definition at line 102 of file vae_device.hpp.