Mercurial > hg > svcore
annotate base/PlayParameterRepository.cpp @ 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 | |
children | 8460b3bf8f04 |
rev | line source |
---|---|
Chris@28 | 1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ |
Chris@28 | 2 |
Chris@28 | 3 /* |
Chris@28 | 4 A waveform viewer and audio annotation editor. |
Chris@28 | 5 Chris Cannam, Queen Mary University of London, 2005-2006 |
Chris@28 | 6 |
Chris@28 | 7 This is experimental software. Not for distribution. |
Chris@28 | 8 */ |
Chris@28 | 9 |
Chris@28 | 10 #include "PlayParameterRepository.h" |
Chris@28 | 11 #include "PlayParameters.h" |
Chris@28 | 12 |
Chris@28 | 13 PlayParameterRepository * |
Chris@28 | 14 PlayParameterRepository::m_instance = new PlayParameterRepository; |
Chris@28 | 15 |
Chris@28 | 16 PlayParameterRepository * |
Chris@28 | 17 PlayParameterRepository::instance() |
Chris@28 | 18 { |
Chris@28 | 19 return m_instance; |
Chris@28 | 20 } |
Chris@28 | 21 |
Chris@28 | 22 PlayParameterRepository::~PlayParameterRepository() |
Chris@28 | 23 { |
Chris@28 | 24 } |
Chris@28 | 25 |
Chris@28 | 26 PlayParameters * |
Chris@28 | 27 PlayParameterRepository::getPlayParameters(const Model *model) |
Chris@28 | 28 { |
Chris@28 | 29 if (m_playParameters.find(model) == m_playParameters.end()) { |
Chris@28 | 30 // Give all models the same type of play parameters for the moment |
Chris@28 | 31 m_playParameters[model] = new PlayParameters; |
Chris@28 | 32 } |
Chris@28 | 33 |
Chris@28 | 34 return m_playParameters[model]; |
Chris@28 | 35 } |
Chris@28 | 36 |
Chris@28 | 37 void |
Chris@28 | 38 PlayParameterRepository::clear() |
Chris@28 | 39 { |
Chris@28 | 40 while (!m_playParameters.empty()) { |
Chris@28 | 41 delete m_playParameters.begin()->second; |
Chris@28 | 42 m_playParameters.erase(m_playParameters.begin()); |
Chris@28 | 43 } |
Chris@28 | 44 } |
Chris@28 | 45 |