# HG changeset patch # User Chris Cannam # Date 1140026315 0 # Node ID 4b16526b011b5fecf83fb85566af059c346ecf00 # Parent 070e9e1e40eaf2dd1e2c352950d979c45d074252 * Add LED button * Add note model playback (currently assuming that value == MIDI pitch) * Reorganise PlayParameters and move repository from ViewManager to new PlayParameterRepository class diff -r 070e9e1e40ea -r 4b16526b011b base/Layer.cpp --- a/base/Layer.cpp Tue Feb 14 17:43:14 2006 +0000 +++ b/base/Layer.cpp Wed Feb 15 17:58:35 2006 +0000 @@ -13,6 +13,7 @@ #include #include "layer/LayerFactory.h" //!!! shouldn't be including this here -- does that suggest we need to move this into layer/ ? +#include "PlayParameterRepository.h" Layer::Layer(View *w) { @@ -73,6 +74,18 @@ return s; } +PlayParameters * +Layer::getPlayParameters() const +{ + const Model *model = getModel(); + if (model) { + return PlayParameterRepository::instance()->getPlayParameters(model); + } + return 0; +} + + + #ifdef INCLUDE_MOCFILES #include "Layer.moc.cpp" #endif diff -r 070e9e1e40ea -r 4b16526b011b base/Layer.h --- a/base/Layer.h Tue Feb 14 17:43:14 2006 +0000 +++ b/base/Layer.h Wed Feb 15 17:58:35 2006 +0000 @@ -203,6 +203,8 @@ */ virtual void setLayerDormant() { } + virtual PlayParameters *getPlayParameters() const; + signals: void modelChanged(); void modelCompletionChanged(); diff -r 070e9e1e40ea -r 4b16526b011b base/PlayParameterRepository.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/base/PlayParameterRepository.cpp Wed Feb 15 17:58:35 2006 +0000 @@ -0,0 +1,45 @@ +/* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ + +/* + A waveform viewer and audio annotation editor. + Chris Cannam, Queen Mary University of London, 2005-2006 + + This is experimental software. Not for distribution. +*/ + +#include "PlayParameterRepository.h" +#include "PlayParameters.h" + +PlayParameterRepository * +PlayParameterRepository::m_instance = new PlayParameterRepository; + +PlayParameterRepository * +PlayParameterRepository::instance() +{ + return m_instance; +} + +PlayParameterRepository::~PlayParameterRepository() +{ +} + +PlayParameters * +PlayParameterRepository::getPlayParameters(const Model *model) +{ + if (m_playParameters.find(model) == m_playParameters.end()) { + // Give all models the same type of play parameters for the moment + m_playParameters[model] = new PlayParameters; + } + + return m_playParameters[model]; +} + +void +PlayParameterRepository::clear() +{ + while (!m_playParameters.empty()) { + delete m_playParameters.begin()->second; + m_playParameters.erase(m_playParameters.begin()); + } +} + diff -r 070e9e1e40ea -r 4b16526b011b base/PlayParameterRepository.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/base/PlayParameterRepository.h Wed Feb 15 17:58:35 2006 +0000 @@ -0,0 +1,36 @@ +/* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ + +/* + A waveform viewer and audio annotation editor. + Chris Cannam, Queen Mary University of London, 2005-2006 + + This is experimental software. Not for distribution. +*/ + +#ifndef _PLAY_PARAMETER_REPOSITORY_H_ +#define _PLAY_PARAMETER_REPOSITORY_H_ + +class PlayParameters; +class Model; + +#include + +class PlayParameterRepository +{ +public: + static PlayParameterRepository *instance(); + + virtual ~PlayParameterRepository(); + +//!!! No way to remove a model! + PlayParameters *getPlayParameters(const Model *model); + + void clear(); + +protected: + std::map m_playParameters; + + static PlayParameterRepository *m_instance; +}; + +#endif diff -r 070e9e1e40ea -r 4b16526b011b base/PlayParameters.h --- a/base/PlayParameters.h Tue Feb 14 17:43:14 2006 +0000 +++ b/base/PlayParameters.h Wed Feb 15 17:58:35 2006 +0000 @@ -7,8 +7,8 @@ This is experimental software. Not for distribution. */ -#ifndef _PLAYABLE_H_ -#define _PLAYABLE_H_ +#ifndef _PLAY_PARAMETERS_H_ +#define _PLAY_PARAMETERS_H_ #include diff -r 070e9e1e40ea -r 4b16526b011b base/PropertyContainer.h --- a/base/PropertyContainer.h Tue Feb 14 17:43:14 2006 +0000 +++ b/base/PropertyContainer.h Wed Feb 15 17:58:35 2006 +0000 @@ -14,7 +14,7 @@ #include #include -class Playable; +class PlayParameters; class PropertyContainer { @@ -82,7 +82,7 @@ virtual QString getPropertyContainerName() const = 0; virtual QString getPropertyContainerIconName() const = 0; - Playable *getPlayable() const { return 0; } + virtual PlayParameters *getPlayParameters() const { return 0; } }; #endif diff -r 070e9e1e40ea -r 4b16526b011b base/ViewManager.cpp --- a/base/ViewManager.cpp Tue Feb 14 17:43:14 2006 +0000 +++ b/base/ViewManager.cpp Wed Feb 15 17:58:35 2006 +0000 @@ -9,7 +9,6 @@ #include "ViewManager.h" #include "AudioPlaySource.h" -#include "PlayParameters.h" #include "Model.h" #include @@ -178,26 +177,6 @@ m_playSource = source; } -PlayParameters * -ViewManager::getPlayParameters(const Model *model) -{ - if (m_playParameters.find(model) == m_playParameters.end()) { - // Give all models the same type of play parameters for the moment - m_playParameters[model] = new PlayParameters; - } - - return m_playParameters[model]; -} - -void -ViewManager::clearPlayParameters() -{ - while (!m_playParameters.empty()) { - delete m_playParameters.begin()->second; - m_playParameters.erase(m_playParameters.begin()); - } -} - void ViewManager::playStatusChanged(bool playing) { diff -r 070e9e1e40ea -r 4b16526b011b base/ViewManager.h --- a/base/ViewManager.h Tue Feb 14 17:43:14 2006 +0000 +++ b/base/ViewManager.h Wed Feb 15 17:58:35 2006 +0000 @@ -18,7 +18,6 @@ #include "Selection.h" class AudioPlaySource; -class PlayParameters; class Model; /** @@ -40,10 +39,6 @@ void setAudioPlaySource(AudioPlaySource *source); -//!!! No way to remove a model! - PlayParameters *getPlayParameters(const Model *model); - void clearPlayParameters(); - bool isPlaying() const; unsigned long getGlobalCentreFrame() const; @@ -140,8 +135,6 @@ bool m_playLoopMode; bool m_playSelectionMode; - - std::map m_playParameters; }; #endif diff -r 070e9e1e40ea -r 4b16526b011b plugin/DSSIPluginInstance.cpp --- a/plugin/DSSIPluginInstance.cpp Tue Feb 14 17:43:14 2006 +0000 +++ b/plugin/DSSIPluginInstance.cpp Wed Feb 15 17:58:35 2006 +0000 @@ -20,7 +20,7 @@ #include "PluginIdentifier.h" #include "LADSPAPluginFactory.h" -#define DEBUG_DSSI 1 +//#define DEBUG_DSSI 1 //#define DEBUG_DSSI_PROCESS 1 #define EVENT_BUFFER_SIZE 1023