Mercurial > hg > svapp
changeset 10:b6dc944128da
* Add basics of MIDI file import. Doesn't actually create the model yet.
* Add rewind to start / ffwd to end.
* Make zoom constraint default to sqrt(2) type if no constraint set
author | Chris Cannam |
---|---|
date | Thu, 09 Feb 2006 18:01:52 +0000 |
parents | e71385792d9d |
children | 8dc0ae8fccdd |
files | audioio/AudioCallbackPlaySource.cpp audioio/AudioGenerator.cpp audioio/AudioGenerator.h |
diffstat | 3 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/audioio/AudioCallbackPlaySource.cpp Wed Feb 08 17:59:16 2006 +0000 +++ b/audioio/AudioCallbackPlaySource.cpp Thu Feb 09 18:01:52 2006 +0000 @@ -80,7 +80,7 @@ void AudioCallbackPlaySource::addModel(Model *model) { - m_audioGenerator->addModel(model); + bool canPlay = m_audioGenerator->addModel(model); m_mutex.lock(); @@ -122,7 +122,7 @@ clearRingBuffers(true, modelChannels); buffersChanged = true; } else { - clearRingBuffers(true); + if (canPlay) clearRingBuffers(true); } if (buffersChanged || srChanged) {
--- a/audioio/AudioGenerator.cpp Wed Feb 08 17:59:16 2006 +0000 +++ b/audioio/AudioGenerator.cpp Thu Feb 09 18:01:52 2006 +0000 @@ -38,7 +38,7 @@ { } -void +bool AudioGenerator::addModel(Model *model) { if (m_sourceSampleRate == 0) { @@ -52,12 +52,13 @@ if (dtvm) { m_sourceSampleRate = model->getSampleRate(); + return true; } } SparseOneDimensionalModel *sodm = dynamic_cast<SparseOneDimensionalModel *>(model); - if (!sodm) return; // nothing else to initialise + if (!sodm) return false; // nothing else to initialise // QString pluginId = "dssi:/usr/lib/dssi/dssi-vst.so:FEARkILLERrev1.dll"; // QString pluginId = "dssi:/usr/lib/dssi/hexter.so:hexter"; @@ -71,7 +72,7 @@ if (!factory) { std::cerr << "Failed to get plugin factory" << std::endl; - return; + return false; } RealTimePluginInstance *instance = @@ -93,7 +94,10 @@ instance->setIdealChannelCount(m_targetChannelCount); // reset! } else { std::cerr << "Failed to instantiate plugin" << std::endl; + return false; } + + return true; } void
--- a/audioio/AudioGenerator.h Wed Feb 08 17:59:16 2006 +0000 +++ b/audioio/AudioGenerator.h Thu Feb 09 18:01:52 2006 +0000 @@ -30,8 +30,10 @@ /** * Add a data model to be played from and initialise any * necessary audio generation code. + * Returns true if the model is of a type that we know how to play. + * (The model will be added regardless.) */ - virtual void addModel(Model *model); + virtual bool addModel(Model *model); /** * Remove a model.