#include <AudioGenerator.h>
Definition at line 31 of file AudioGenerator.h.
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 plugins and the like. | |
| virtual void | setTargetChannelCount (size_t channelCount) |
| Set the target channel count. | |
| virtual size_t | getBlockSize () const |
| Return the internal processing block size. | |
| virtual size_t | mixModel (Model *model, size_t startFrame, size_t frameCount, float **buffer, size_t fadeIn=0, size_t 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). | |
Static Public Member Functions | |
| static bool | canPlay (const Model *model) |
| Return true if the given model is of a type that we generally know how to play. | |
| static QString | getDefaultPlayPluginId (const Model *model) |
| static QString | getDefaultPlayPluginConfiguration (const Model *model) |
Protected Types | |
| typedef std::map< const Model *, RealTimePluginInstance * > | PluginMap |
| typedef std::set< NoteOff, NoteOff::Comparator > | NoteOffSet |
| typedef std::map< const Model *, NoteOffSet > | NoteOffMap |
Protected Slots | |
| void | playPluginIdChanged (const Model *, QString) |
| void | playPluginConfigurationChanged (const Model *, QString) |
Protected Member Functions | |
| virtual RealTimePluginInstance * | loadPluginFor (const Model *model) |
| virtual RealTimePluginInstance * | loadPlugin (QString id, QString program) |
| virtual size_t | mixDenseTimeValueModel (DenseTimeValueModel *model, size_t startFrame, size_t frameCount, float **buffer, float gain, float pan, size_t fadeIn, size_t fadeOut) |
| virtual size_t | mixSparseOneDimensionalModel (SparseOneDimensionalModel *model, size_t startFrame, size_t frameCount, float **buffer, float gain, float pan, size_t fadeIn, size_t fadeOut) |
| virtual size_t | mixNoteModel (NoteModel *model, size_t startFrame, size_t frameCount, float **buffer, float gain, float pan, size_t fadeIn, size_t fadeOut) |
| !! mucho duplication with above -- refactor | |
Static Protected Member Functions | |
| static QString | getSampleDir () |
| static void | setSampleDir (RealTimePluginInstance *plugin) |
Protected Attributes | |
| size_t | m_sourceSampleRate |
| size_t | m_targetChannelCount |
| bool | m_soloing |
| std::set< Model * > | m_soloModelSet |
| QMutex | m_mutex |
| PluginMap | m_synthMap |
| NoteOffMap | m_noteOffs |
Static Protected Attributes | |
| static QString | m_sampleDir |
| static const size_t | m_pluginBlockSize |
Classes | |
| struct | NoteOff |
typedef std::map<const Model *, RealTimePluginInstance *> AudioGenerator::PluginMap [protected] |
Definition at line 127 of file AudioGenerator.h.
typedef std::set<NoteOff, NoteOff::Comparator> AudioGenerator::NoteOffSet [protected] |
Definition at line 129 of file AudioGenerator.h.
typedef std::map<const Model *, NoteOffSet> AudioGenerator::NoteOffMap [protected] |
Definition at line 130 of file AudioGenerator.h.
| AudioGenerator::AudioGenerator | ( | ) |
Definition at line 48 of file AudioGenerator.cpp.
References PlayParameterRepository::getInstance(), playPluginConfigurationChanged(), and playPluginIdChanged().
| AudioGenerator::~AudioGenerator | ( | ) | [virtual] |
Definition at line 64 of file AudioGenerator.cpp.
| bool AudioGenerator::canPlay | ( | const Model * | model | ) | [static] |
Return true if the given model is of a type that we generally know how to play.
This doesn't guarantee that a specific AudioGenerator will actually produce sounds for it (for example, it may turn out that a vital plugin is missing).
Definition at line 69 of file AudioGenerator.cpp.
Referenced by PlayParameterRepository::addModel().
| QString AudioGenerator::getDefaultPlayPluginId | ( | const Model * | model | ) | [static] |
Definition at line 139 of file AudioGenerator.cpp.
References PluginIdentifier::BUILTIN_PLUGIN_SONAME.
Referenced by PlayParameterRepository::addModel(), and loadPluginFor().
| QString AudioGenerator::getDefaultPlayPluginConfiguration | ( | const Model * | model | ) | [static] |
Definition at line 158 of file AudioGenerator.cpp.
References PluginXml::encodeConfigurationChars(), XmlExportable::encodeEntities(), and getSampleDir().
Referenced by PlayParameterRepository::addModel(), and loadPluginFor().
| 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 return value test here is stricter than that for canPlay, above.) The model will be added regardless of the return value.
Definition at line 81 of file AudioGenerator.cpp.
References Model::getSampleRate(), loadPluginFor(), m_mutex, m_sourceSampleRate, and m_synthMap.
Referenced by AudioCallbackPlaySource::addModel().
| void AudioGenerator::removeModel | ( | Model * | model | ) | [virtual] |
Remove a model.
Definition at line 295 of file AudioGenerator.cpp.
References m_mutex, and m_synthMap.
Referenced by AudioCallbackPlaySource::removeModel().
| void AudioGenerator::clearModels | ( | ) | [virtual] |
Remove all models.
Definition at line 311 of file AudioGenerator.cpp.
References m_mutex, and m_synthMap.
Referenced by AudioCallbackPlaySource::clearModels().
| void AudioGenerator::reset | ( | ) | [virtual] |
Reset playback, clearing plugins and the like.
Definition at line 322 of file AudioGenerator.cpp.
References m_mutex, m_noteOffs, and m_synthMap.
Referenced by AudioCallbackPlaySource::play().
| void AudioGenerator::setTargetChannelCount | ( | size_t | 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 336 of file AudioGenerator.cpp.
References m_mutex, m_synthMap, and m_targetChannelCount.
Referenced by AudioCallbackPlaySource::addModel().
| size_t 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 351 of file AudioGenerator.cpp.
References m_pluginBlockSize.
Referenced by AudioCallbackPlaySource::fillBuffers().
| size_t AudioGenerator::mixModel | ( | Model * | model, | |
| size_t | startFrame, | |||
| size_t | frameCount, | |||
| float ** | buffer, | |||
| size_t | fadeIn = 0, |
|||
| size_t | fadeOut = 0 | |||
| ) | [virtual] |
Mix a single model into an output buffer.
Definition at line 375 of file AudioGenerator.cpp.
References PlayParameterRepository::getInstance(), PlayParameters::getPlayGain(), PlayParameters::getPlayPan(), PlayParameterRepository::getPlayParameters(), PlayParameters::isPlayMuted(), m_mutex, m_soloing, m_soloModelSet, m_sourceSampleRate, mixDenseTimeValueModel(), mixNoteModel(), and mixSparseOneDimensionalModel().
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 357 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 366 of file AudioGenerator.cpp.
References m_mutex, m_soloing, and m_soloModelSet.
Referenced by AudioCallbackPlaySource::clearSoloModelSet().
| void AudioGenerator::playPluginIdChanged | ( | const Model * | , | |
| QString | ||||
| ) | [protected, slot] |
Definition at line 109 of file AudioGenerator.cpp.
References loadPluginFor(), m_mutex, and m_synthMap.
Referenced by AudioGenerator().
| void AudioGenerator::playPluginConfigurationChanged | ( | const Model * | , | |
| QString | ||||
| ) | [protected, slot] |
Definition at line 122 of file AudioGenerator.cpp.
References m_synthMap.
Referenced by AudioGenerator().
| RealTimePluginInstance * AudioGenerator::loadPluginFor | ( | const Model * | model | ) | [protected, virtual] |
Definition at line 222 of file AudioGenerator.cpp.
References getDefaultPlayPluginConfiguration(), getDefaultPlayPluginId(), PlayParameterRepository::getInstance(), PlayParameterRepository::getPlayParameters(), PlayParameters::getPlayPluginConfiguration(), PlayParameters::getPlayPluginId(), loadPlugin(), PlayParameters::setPlayPluginConfiguration(), and PlayParameters::setPlayPluginId().
Referenced by addModel(), and playPluginIdChanged().
| RealTimePluginInstance * AudioGenerator::loadPlugin | ( | QString | id, | |
| QString | program | |||
| ) | [protected, virtual] |
Definition at line 256 of file AudioGenerator.cpp.
References RealTimePluginInstance::getParameterCount(), RealTimePluginInstance::getParameterDefault(), RealTimePluginInstance::getProgram(), RealTimePluginFactory::instanceFor(), RealTimePluginFactory::instantiatePlugin(), m_pluginBlockSize, m_sourceSampleRate, m_targetChannelCount, RealTimePluginInstance::setIdealChannelCount(), RealTimePluginInstance::setParameterValue(), and setSampleDir().
Referenced by loadPluginFor().
| QString AudioGenerator::getSampleDir | ( | ) | [static, protected] |
Definition at line 184 of file AudioGenerator.cpp.
References TempDirectory::getInstance(), TempDirectory::getSubDirectoryPath(), and m_sampleDir.
Referenced by getDefaultPlayPluginConfiguration(), and setSampleDir().
| void AudioGenerator::setSampleDir | ( | RealTimePluginInstance * | plugin | ) | [static, protected] |
Definition at line 216 of file AudioGenerator.cpp.
References RealTimePluginInstance::configure(), and getSampleDir().
Referenced by loadPlugin().
| size_t AudioGenerator::mixDenseTimeValueModel | ( | DenseTimeValueModel * | model, | |
| size_t | startFrame, | |||
| size_t | frameCount, | |||
| float ** | buffer, | |||
| float | gain, | |||
| float | pan, | |||
| size_t | fadeIn, | |||
| size_t | fadeOut | |||
| ) | [protected, virtual] |
Definition at line 432 of file AudioGenerator.cpp.
References DenseTimeValueModel::getChannelCount(), DenseTimeValueModel::getData(), and m_targetChannelCount.
Referenced by mixModel().
| size_t AudioGenerator::mixSparseOneDimensionalModel | ( | SparseOneDimensionalModel * | model, | |
| size_t | startFrame, | |||
| size_t | frameCount, | |||
| float ** | buffer, | |||
| float | gain, | |||
| float | pan, | |||
| size_t | fadeIn, | |||
| size_t | fadeOut | |||
| ) | [protected, virtual] |
Definition at line 527 of file AudioGenerator.cpp.
References AudioGenerator::NoteOff::frame, RealTimePluginInstance::getAudioOutputBuffers(), RealTimePluginInstance::getAudioOutputCount(), RealTimePluginInstance::getLatency(), SparseModel< PointType >::getPoints(), m_noteOffs, m_pluginBlockSize, m_sourceSampleRate, m_synthMap, m_targetChannelCount, AudioGenerator::NoteOff::pitch, RealTimePluginInstance::run(), and RealTimePluginInstance::sendEvent().
Referenced by mixModel().
| size_t AudioGenerator::mixNoteModel | ( | NoteModel * | model, | |
| size_t | startFrame, | |||
| size_t | frameCount, | |||
| float ** | buffer, | |||
| float | gain, | |||
| float | pan, | |||
| size_t | fadeIn, | |||
| size_t | fadeOut | |||
| ) | [protected, virtual] |
!! mucho duplication with above -- refactor
!! hang on -- the fact that the audio callback play source's
Definition at line 671 of file AudioGenerator.cpp.
References AudioGenerator::NoteOff::frame, RealTimePluginInstance::getAudioOutputBuffers(), RealTimePluginInstance::getAudioOutputCount(), RealTimePluginInstance::getLatency(), Pitch::getPitchForFrequency(), NoteModel::getPoints(), SparseValueModel< PointType >::getScaleUnits(), m_noteOffs, m_pluginBlockSize, m_sourceSampleRate, m_synthMap, m_targetChannelCount, AudioGenerator::NoteOff::pitch, RealTimePluginInstance::run(), and RealTimePluginInstance::sendEvent().
Referenced by mixModel().
size_t AudioGenerator::m_sourceSampleRate [protected] |
Definition at line 109 of file AudioGenerator.h.
Referenced by addModel(), loadPlugin(), mixModel(), mixNoteModel(), and mixSparseOneDimensionalModel().
size_t AudioGenerator::m_targetChannelCount [protected] |
Definition at line 110 of file AudioGenerator.h.
Referenced by loadPlugin(), mixDenseTimeValueModel(), mixNoteModel(), mixSparseOneDimensionalModel(), and setTargetChannelCount().
bool AudioGenerator::m_soloing [protected] |
Definition at line 112 of file AudioGenerator.h.
Referenced by clearSoloModelSet(), mixModel(), and setSoloModelSet().
std::set<Model *> AudioGenerator::m_soloModelSet [protected] |
Definition at line 113 of file AudioGenerator.h.
Referenced by clearSoloModelSet(), mixModel(), and setSoloModelSet().
QMutex AudioGenerator::m_mutex [protected] |
Definition at line 132 of file AudioGenerator.h.
Referenced by addModel(), clearModels(), clearSoloModelSet(), mixModel(), playPluginIdChanged(), removeModel(), reset(), setSoloModelSet(), and setTargetChannelCount().
PluginMap AudioGenerator::m_synthMap [protected] |
Definition at line 133 of file AudioGenerator.h.
Referenced by addModel(), clearModels(), mixNoteModel(), mixSparseOneDimensionalModel(), playPluginConfigurationChanged(), playPluginIdChanged(), removeModel(), reset(), and setTargetChannelCount().
NoteOffMap AudioGenerator::m_noteOffs [protected] |
Definition at line 134 of file AudioGenerator.h.
Referenced by mixNoteModel(), mixSparseOneDimensionalModel(), and reset().
QString AudioGenerator::m_sampleDir [static, protected] |
const size_t AudioGenerator::m_pluginBlockSize [static, protected] |
Definition at line 154 of file AudioGenerator.h.
Referenced by getBlockSize(), loadPlugin(), mixNoteModel(), and mixSparseOneDimensionalModel().
1.5.1