Mercurial > hg > svapp
changeset 686:610fa108fbcc by-id
Update for changes to PlayParameters
author | Chris Cannam |
---|---|
date | Thu, 04 Jul 2019 18:04:59 +0100 |
parents | 7540733f5480 |
children | e0b0f3e163ca |
files | audio/AudioGenerator.cpp framework/Document.cpp framework/MainWindowBase.cpp framework/SVFileReader.cpp framework/SVFileReader.h |
diffstat | 5 files changed, 15 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/audio/AudioGenerator.cpp Thu Jul 04 14:31:22 2019 +0100 +++ b/audio/AudioGenerator.cpp Thu Jul 04 18:04:59 2019 +0100 @@ -131,7 +131,7 @@ } } - PlayParameters *parameters = + auto parameters = PlayParameterRepository::getInstance()->getPlayParameters (modelId.untyped); @@ -222,7 +222,7 @@ { QString clipId; - PlayParameters *parameters = + auto parameters = PlayParameterRepository::getInstance()->getPlayParameters (modelId.untyped); if (parameters) { @@ -374,7 +374,7 @@ auto model = ModelById::get(modelId); if (!model || !model->canPlay()) return frameCount; - PlayParameters *parameters = + auto parameters = PlayParameterRepository::getInstance()->getPlayParameters (modelId.untyped); if (!parameters) return frameCount;
--- a/framework/Document.cpp Thu Jul 04 14:31:22 2019 +0100 +++ b/framework/Document.cpp Thu Jul 04 18:04:59 2019 +0100 @@ -554,6 +554,12 @@ emit mainModelChanged(m_mainModel); + // Remove the playable explicitly - the main model's dtor will do + // this, but just in case something is still hanging onto a + // shared_ptr to the old main model so it doesn't get deleted yet + PlayParameterRepository::getInstance()->removePlayable + (oldMainModel.untyped); + ModelById::release(oldMainModel); } @@ -1337,7 +1343,7 @@ mainModel->toXml(out, indent + " ", "mainModel=\"true\""); } - PlayParameters *playParameters = + auto playParameters = PlayParameterRepository::getInstance()->getPlayParameters (m_mainModel.untyped); if (playParameters) { @@ -1484,8 +1490,7 @@ modelId, rec.second); } - //!!! We should probably own the PlayParameterRepository - PlayParameters *playParameters = + auto playParameters = PlayParameterRepository::getInstance()->getPlayParameters (modelId.untyped); if (playParameters) {
--- a/framework/MainWindowBase.cpp Thu Jul 04 14:31:22 2019 +0100 +++ b/framework/MainWindowBase.cpp Thu Jul 04 18:04:59 2019 +0100 @@ -63,7 +63,6 @@ #include "base/RecentFiles.h" -#include "base/PlayParameterRepository.h" #include "base/XmlExportable.h" #include "base/Profiler.h" #include "base/Preferences.h" @@ -1694,11 +1693,7 @@ ModelId prevMain = getMainModelId(); if (!prevMain.isNone()) { m_playSource->removeModel(prevMain); - //!!! shouldn't this stuff be handled by Document? - PlayParameterRepository::getInstance()->removePlayable - (prevMain.untyped); } - PlayParameterRepository::getInstance()->addPlayable(newModel.untyped); SVDEBUG << "SV about to call setMainModel(" << newModel << "): prevMain is " << prevMain << endl; @@ -3284,7 +3279,6 @@ auto modelId = modelPtr->getId(); ModelById::add(std::shared_ptr<Model>(modelPtr)); - PlayParameterRepository::getInstance()->addPlayable(modelId.untyped); if (m_audioRecordMode == RecordReplaceSession || !getMainModel()) { @@ -3299,8 +3293,6 @@ SVCERR << "MainWindowBase::record: Session template open cancelled, stopping and suspending" << endl; m_recordTarget->stopRecording(); m_audioIO->suspend(); - PlayParameterRepository::getInstance()->removePlayable - (modelId.untyped); ModelById::release(modelId); return; } @@ -3317,8 +3309,6 @@ ModelId prevMain = getMainModelId(); if (!prevMain.isNone()) { m_playSource->removeModel(prevMain); - PlayParameterRepository::getInstance()->removePlayable - (prevMain.untyped); } m_document->setMainModel(modelId);
--- a/framework/SVFileReader.cpp Thu Jul 04 14:31:22 2019 +0100 +++ b/framework/SVFileReader.cpp Thu Jul 04 18:04:59 2019 +0100 @@ -61,7 +61,6 @@ m_currentDataset(XmlExportable::NO_ID), m_currentLayer(nullptr), m_pendingDerivedModel(XmlExportable::NO_ID), - m_currentPlayParameters(nullptr), m_currentTransformChannel(0), m_currentTransformIsNewStyle(true), m_datasetSeparator(" "), @@ -358,7 +357,7 @@ } else if (name == "selections") { m_inSelections = false; } else if (name == "playparameters") { - m_currentPlayParameters = nullptr; + m_currentPlayParameters = {}; } return true; @@ -1373,7 +1372,7 @@ bool SVFileReader::readPlayParameters(const QXmlAttributes &attributes) { - m_currentPlayParameters = nullptr; + m_currentPlayParameters = {}; int modelExportId = 0; bool modelOk = false; @@ -1388,7 +1387,7 @@ bool ok = false; - PlayParameters *parameters = PlayParameterRepository::getInstance()-> + auto parameters = PlayParameterRepository::getInstance()-> getPlayParameters(m_models[modelExportId].untyped); if (!parameters) {
--- a/framework/SVFileReader.h Thu Jul 04 14:31:22 2019 +0100 +++ b/framework/SVFileReader.h Thu Jul 04 18:04:59 2019 +0100 @@ -282,7 +282,7 @@ Layer *m_currentLayer; ModelId m_currentDerivedModel; ExportId m_pendingDerivedModel; - PlayParameters *m_currentPlayParameters; + std::shared_ptr<PlayParameters> m_currentPlayParameters; Transform m_currentTransform; ModelId m_currentTransformSource; int m_currentTransformChannel;