Mercurial > hg > svcore
changeset 28:4b16526b011b
* Add LED button
* Add note model playback (currently assuming that value == MIDI pitch)
* Reorganise PlayParameters and move repository from ViewManager to new
PlayParameterRepository class
author | Chris Cannam |
---|---|
date | Wed, 15 Feb 2006 17:58:35 +0000 |
parents | 070e9e1e40ea |
children | 8460b3bf8f04 |
files | base/Layer.cpp base/Layer.h base/PlayParameterRepository.cpp base/PlayParameterRepository.h base/PlayParameters.h base/PropertyContainer.h base/ViewManager.cpp base/ViewManager.h plugin/DSSIPluginInstance.cpp |
diffstat | 9 files changed, 101 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- 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 <iostream> #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
--- 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();
--- /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()); + } +} +
--- /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 <map> + +class PlayParameterRepository +{ +public: + static PlayParameterRepository *instance(); + + virtual ~PlayParameterRepository(); + +//!!! No way to remove a model! + PlayParameters *getPlayParameters(const Model *model); + + void clear(); + +protected: + std::map<const Model *, PlayParameters *> m_playParameters; + + static PlayParameterRepository *m_instance; +}; + +#endif
--- 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 <QObject>
--- 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 <QObject> #include <vector> -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
--- 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 <iostream> @@ -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) {
--- 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<const Model *, PlayParameters *> m_playParameters; }; #endif
--- 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