svapp
1.9
|
#include <AudioGenerator.h>
Classes | |
struct | NoteOff |
Public Member Functions | |
AudioGenerator () | |
virtual | ~AudioGenerator () |
virtual bool | addModel (Model *model) |
Add a data model to be played from and initialise any necessary audio generation code. | |
virtual void | removeModel (Model *model) |
Remove a model. | |
virtual void | clearModels () |
Remove all models. | |
virtual void | reset () |
Reset playback, clearing buffers and the like. | |
virtual void | setTargetChannelCount (int channelCount) |
Set the target channel count. | |
virtual int | getBlockSize () const |
Return the internal processing block size. | |
virtual int | mixModel (Model *model, int startFrame, int frameCount, float **buffer, int fadeIn=0, int fadeOut=0) |
Mix a single model into an output buffer. | |
virtual void | setSoloModelSet (std::set< Model * >s) |
Specify that only the given set of models should be played. | |
virtual void | clearSoloModelSet () |
Specify that all models should be played as normal (if not muted). | |
Protected Types | |
typedef std::map< const Model *, ClipMixer * > | ClipMixerMap |
typedef std::multiset< NoteOff, NoteOff::Comparator > | NoteOffSet |
typedef std::map< const Model *, NoteOffSet > | NoteOffMap |
typedef std::map< const Model *, ContinuousSynth * > | ContinuousSynthMap |
Protected Slots | |
void | playClipIdChanged (const Playable *, QString) |
Protected Member Functions | |
bool | usesClipMixer (const Model *) |
bool | wantsQuieterClips (const Model *) |
bool | usesContinuousSynth (const Model *) |
ClipMixer * | makeClipMixerFor (const Model *model) |
ContinuousSynth * | makeSynthFor (const Model *model) |
virtual int | mixDenseTimeValueModel (DenseTimeValueModel *model, int startFrame, int frameCount, float **buffer, float gain, float pan, int fadeIn, int fadeOut) |
virtual int | mixClipModel (Model *model, int startFrame, int frameCount, float **buffer, float gain, float pan) |
virtual int | mixContinuousSynthModel (Model *model, int startFrame, int frameCount, float **buffer, float gain, float pan) |
Static Protected Member Functions | |
static void | initialiseSampleDir () |
Protected Attributes | |
int | m_sourceSampleRate |
int | m_targetChannelCount |
int | m_waveType |
bool | m_soloing |
std::set< Model * > | m_soloModelSet |
QMutex | m_mutex |
ClipMixerMap | m_clipMixerMap |
NoteOffMap | m_noteOffs |
ContinuousSynthMap | m_continuousSynthMap |
float ** | m_channelBuffer |
int | m_channelBufSiz |
int | m_channelBufCount |
Static Protected Attributes | |
static QString | m_sampleDir = "" |
static const int | m_processingBlockSize = 1024 |
Definition at line 35 of file AudioGenerator.h.
typedef std::map<const Model *, ClipMixer *> AudioGenerator::ClipMixerMap [protected] |
Definition at line 122 of file AudioGenerator.h.
typedef std::multiset<NoteOff, NoteOff::Comparator> AudioGenerator::NoteOffSet [protected] |
Definition at line 124 of file AudioGenerator.h.
typedef std::map<const Model *, NoteOffSet> AudioGenerator::NoteOffMap [protected] |
Definition at line 125 of file AudioGenerator.h.
typedef std::map<const Model *, ContinuousSynth *> AudioGenerator::ContinuousSynthMap [protected] |
Definition at line 127 of file AudioGenerator.h.
Definition at line 48 of file AudioGenerator.cpp.
References initialiseSampleDir(), and playClipIdChanged().
AudioGenerator::~AudioGenerator | ( | ) | [virtual] |
Definition at line 65 of file AudioGenerator.cpp.
bool AudioGenerator::addModel | ( | Model * | model | ) | [virtual] |
Add a data model to be played from and initialise any necessary audio generation code.
Returns true if the model will be played. The model will be added regardless of the return value.
Definition at line 110 of file AudioGenerator.cpp.
References m_clipMixerMap, m_continuousSynthMap, m_mutex, m_sourceSampleRate, makeClipMixerFor(), makeSynthFor(), usesClipMixer(), and usesContinuousSynth().
Referenced by AudioCallbackPlaySource::addModel().
void AudioGenerator::removeModel | ( | Model * | model | ) | [virtual] |
Remove a model.
Definition at line 255 of file AudioGenerator.cpp.
References m_clipMixerMap, and m_mutex.
Referenced by AudioCallbackPlaySource::removeModel().
void AudioGenerator::clearModels | ( | ) | [virtual] |
Remove all models.
Definition at line 271 of file AudioGenerator.cpp.
References m_clipMixerMap, and m_mutex.
Referenced by AudioCallbackPlaySource::clearModels().
void AudioGenerator::reset | ( | ) | [virtual] |
Reset playback, clearing buffers and the like.
Definition at line 283 of file AudioGenerator.cpp.
References m_clipMixerMap, m_mutex, and m_noteOffs.
Referenced by AudioCallbackPlaySource::play().
void AudioGenerator::setTargetChannelCount | ( | int | channelCount | ) | [virtual] |
Set the target channel count.
The buffer parameter to mixModel must always point to at least this number of arrays.
Definition at line 299 of file AudioGenerator.cpp.
References m_clipMixerMap, m_mutex, and m_targetChannelCount.
Referenced by AudioCallbackPlaySource::addModel().
int AudioGenerator::getBlockSize | ( | ) | const [virtual] |
Return the internal processing block size.
The frameCount argument to all mixModel calls must be a multiple of this value.
Definition at line 314 of file AudioGenerator.cpp.
References m_processingBlockSize.
Referenced by AudioCallbackPlaySource::fillBuffers().
int AudioGenerator::mixModel | ( | Model * | model, |
int | startFrame, | ||
int | frameCount, | ||
float ** | buffer, | ||
int | fadeIn = 0 , |
||
int | fadeOut = 0 |
||
) | [virtual] |
Mix a single model into an output buffer.
Definition at line 338 of file AudioGenerator.cpp.
References m_mutex, m_soloing, m_soloModelSet, m_sourceSampleRate, mixClipModel(), mixContinuousSynthModel(), mixDenseTimeValueModel(), usesClipMixer(), and usesContinuousSynth().
Referenced by AudioCallbackPlaySource::mixModels().
void AudioGenerator::setSoloModelSet | ( | std::set< Model * > | s | ) | [virtual] |
Specify that only the given set of models should be played.
Definition at line 320 of file AudioGenerator.cpp.
References m_mutex, m_soloing, and m_soloModelSet.
Referenced by AudioCallbackPlaySource::setSoloModelSet().
void AudioGenerator::clearSoloModelSet | ( | ) | [virtual] |
Specify that all models should be played as normal (if not muted).
Definition at line 329 of file AudioGenerator.cpp.
References m_mutex, m_soloing, and m_soloModelSet.
Referenced by AudioCallbackPlaySource::clearSoloModelSet().
void AudioGenerator::playClipIdChanged | ( | const Playable * | playable, |
QString | |||
) | [protected, slot] |
Definition at line 149 of file AudioGenerator.cpp.
References m_clipMixerMap, m_mutex, and makeClipMixerFor().
Referenced by AudioGenerator().
bool AudioGenerator::usesClipMixer | ( | const Model * | model | ) | [protected] |
Definition at line 169 of file AudioGenerator.cpp.
Referenced by addModel(), and mixModel().
bool AudioGenerator::wantsQuieterClips | ( | const Model * | model | ) | [protected] |
Definition at line 179 of file AudioGenerator.cpp.
Referenced by makeClipMixerFor().
bool AudioGenerator::usesContinuousSynth | ( | const Model * | model | ) | [protected] |
Definition at line 191 of file AudioGenerator.cpp.
Referenced by addModel(), and mixModel().
ClipMixer * AudioGenerator::makeClipMixerFor | ( | const Model * | model | ) | [protected] |
Definition at line 199 of file AudioGenerator.cpp.
References ClipMixer::loadClipData(), m_processingBlockSize, m_sampleDir, m_sourceSampleRate, m_targetChannelCount, and wantsQuieterClips().
Referenced by addModel(), and playClipIdChanged().
ContinuousSynth * AudioGenerator::makeSynthFor | ( | const Model * | model | ) | [protected] |
Definition at line 239 of file AudioGenerator.cpp.
References m_processingBlockSize, m_sourceSampleRate, m_targetChannelCount, and m_waveType.
Referenced by addModel().
void AudioGenerator::initialiseSampleDir | ( | ) | [static, protected] |
Definition at line 73 of file AudioGenerator.cpp.
References m_sampleDir.
Referenced by AudioGenerator().
int AudioGenerator::mixDenseTimeValueModel | ( | DenseTimeValueModel * | model, |
int | startFrame, | ||
int | frameCount, | ||
float ** | buffer, | ||
float | gain, | ||
float | pan, | ||
int | fadeIn, | ||
int | fadeOut | ||
) | [protected, virtual] |
Definition at line 397 of file AudioGenerator.cpp.
References m_channelBufCount, m_channelBuffer, m_channelBufSiz, and m_targetChannelCount.
Referenced by mixModel().
int AudioGenerator::mixClipModel | ( | Model * | model, |
int | startFrame, | ||
int | frameCount, | ||
float ** | buffer, | ||
float | gain, | ||
float | pan | ||
) | [protected, virtual] |
!! todo: the below -- it matters
!! hang on -- the fact that the audio callback play source's
Definition at line 495 of file AudioGenerator.cpp.
References ClipMixer::NoteStart::frameOffset, ClipMixer::NoteEnd::frameOffset, ClipMixer::NoteStart::frequency, ClipMixer::NoteEnd::frequency, ClipMixer::NoteStart::level, m_clipMixerMap, m_noteOffs, m_processingBlockSize, m_targetChannelCount, ClipMixer::mix(), and ClipMixer::NoteStart::pan.
Referenced by mixModel().
int AudioGenerator::mixContinuousSynthModel | ( | Model * | model, |
int | startFrame, | ||
int | frameCount, | ||
float ** | buffer, | ||
float | gain, | ||
float | pan | ||
) | [protected, virtual] |
!! todo: see comment in mixClipModel
Definition at line 613 of file AudioGenerator.cpp.
References m_continuousSynthMap, m_processingBlockSize, m_targetChannelCount, and ContinuousSynth::mix().
Referenced by mixModel().
int AudioGenerator::m_sourceSampleRate [protected] |
Definition at line 100 of file AudioGenerator.h.
Referenced by addModel(), makeClipMixerFor(), makeSynthFor(), and mixModel().
int AudioGenerator::m_targetChannelCount [protected] |
Definition at line 101 of file AudioGenerator.h.
Referenced by makeClipMixerFor(), makeSynthFor(), mixClipModel(), mixContinuousSynthModel(), mixDenseTimeValueModel(), and setTargetChannelCount().
int AudioGenerator::m_waveType [protected] |
Definition at line 102 of file AudioGenerator.h.
Referenced by makeSynthFor().
bool AudioGenerator::m_soloing [protected] |
Definition at line 104 of file AudioGenerator.h.
Referenced by clearSoloModelSet(), mixModel(), and setSoloModelSet().
std::set<Model *> AudioGenerator::m_soloModelSet [protected] |
Definition at line 105 of file AudioGenerator.h.
Referenced by clearSoloModelSet(), mixModel(), and setSoloModelSet().
QMutex AudioGenerator::m_mutex [protected] |
Definition at line 129 of file AudioGenerator.h.
Referenced by addModel(), clearModels(), clearSoloModelSet(), mixModel(), playClipIdChanged(), removeModel(), reset(), setSoloModelSet(), and setTargetChannelCount().
ClipMixerMap AudioGenerator::m_clipMixerMap [protected] |
Definition at line 131 of file AudioGenerator.h.
Referenced by addModel(), clearModels(), mixClipModel(), playClipIdChanged(), removeModel(), reset(), and setTargetChannelCount().
NoteOffMap AudioGenerator::m_noteOffs [protected] |
Definition at line 132 of file AudioGenerator.h.
Referenced by mixClipModel(), and reset().
QString AudioGenerator::m_sampleDir = "" [static, protected] |
Definition at line 133 of file AudioGenerator.h.
Referenced by initialiseSampleDir(), and makeClipMixerFor().
Definition at line 135 of file AudioGenerator.h.
Referenced by addModel(), and mixContinuousSynthModel().
const int AudioGenerator::m_processingBlockSize = 1024 [static, protected] |
Definition at line 158 of file AudioGenerator.h.
Referenced by getBlockSize(), makeClipMixerFor(), makeSynthFor(), mixClipModel(), and mixContinuousSynthModel().
float** AudioGenerator::m_channelBuffer [protected] |
Definition at line 160 of file AudioGenerator.h.
Referenced by mixDenseTimeValueModel().
int AudioGenerator::m_channelBufSiz [protected] |
Definition at line 161 of file AudioGenerator.h.
Referenced by mixDenseTimeValueModel().
int AudioGenerator::m_channelBufCount [protected] |
Definition at line 162 of file AudioGenerator.h.
Referenced by mixDenseTimeValueModel().