Mercurial > hg > svcore
changeset 863:1f98e28f70c6 tonioni
Toward using a sample mixer (with arbitrary frequency target) instead of dssi player plugin
author | Chris Cannam |
---|---|
date | Tue, 07 Jan 2014 10:57:28 +0000 |
parents | 13803edd513d |
children | 6d07bcc844a1 |
files | base/PlayParameterRepository.cpp base/PlayParameterRepository.h base/PlayParameters.cpp base/PlayParameters.h base/Playable.h data/model/DenseTimeValueModel.h data/model/NoteData.h |
diffstat | 7 files changed, 39 insertions(+), 79 deletions(-) [+] |
line wrap: on
line diff
--- a/base/PlayParameterRepository.cpp Wed Dec 04 19:30:02 2013 +0000 +++ b/base/PlayParameterRepository.cpp Tue Jan 07 10:57:28 2014 +0000 @@ -47,21 +47,15 @@ PlayParameters *params = new PlayParameters; m_playParameters[playable] = params; - params->setPlayPluginId - (playable->getDefaultPlayPluginId()); - - params->setPlayPluginConfiguration - (playable->getDefaultPlayPluginConfiguration()); + params->setPlaySampleId + (playable->getDefaultPlaySampleId()); connect(params, SIGNAL(playParametersChanged()), this, SLOT(playParametersChanged())); - connect(params, SIGNAL(playPluginIdChanged(QString)), - this, SLOT(playPluginIdChanged(QString))); + connect(params, SIGNAL(playSampleIdChanged(QString)), + this, SLOT(playSampleIdChanged(QString))); - connect(params, SIGNAL(playPluginConfigurationChanged(QString)), - this, SLOT(playPluginConfigurationChanged(QString))); - cerr << "Connected play parameters " << params << " for playable " << playable << " to this " << this << endl; } @@ -107,27 +101,13 @@ } void -PlayParameterRepository::playPluginIdChanged(QString id) +PlayParameterRepository::playSampleIdChanged(QString id) { PlayParameters *params = dynamic_cast<PlayParameters *>(sender()); for (PlayableParameterMap::iterator i = m_playParameters.begin(); i != m_playParameters.end(); ++i) { if (i->second == params) { - emit playPluginIdChanged(i->first, id); - return; - } - } -} - -void -PlayParameterRepository::playPluginConfigurationChanged(QString config) -{ - PlayParameters *params = dynamic_cast<PlayParameters *>(sender()); -// SVDEBUG << "PlayParameterRepository::playPluginConfigurationChanged" << endl; - for (PlayableParameterMap::iterator i = m_playParameters.begin(); - i != m_playParameters.end(); ++i) { - if (i->second == params) { - emit playPluginConfigurationChanged(i->first, config); + emit playSampleIdChanged(i->first, id); return; } } @@ -175,15 +155,9 @@ } void -PlayParameterRepository::EditCommand::setPlayPluginId(QString id) +PlayParameterRepository::EditCommand::setPlaySampleId(QString id) { - m_to.setPlayPluginId(id); -} - -void -PlayParameterRepository::EditCommand::setPlayPluginConfiguration(QString conf) -{ - m_to.setPlayPluginConfiguration(conf); + m_to.setPlaySampleId(id); } void @@ -221,13 +195,8 @@ if (++changed > 1) return multiname; } - if (m_to.getPlayPluginId() != m_from.getPlayPluginId()) { - name = tr("Change Playback Plugin"); - if (++changed > 1) return multiname; - } - - if (m_to.getPlayPluginConfiguration() != m_from.getPlayPluginConfiguration()) { - name = tr("Configure Playback Plugin"); + if (m_to.getPlaySampleId() != m_from.getPlaySampleId()) { + name = tr("Change Playback Sample"); if (++changed > 1) return multiname; }
--- a/base/PlayParameterRepository.h Wed Dec 04 19:30:02 2013 +0000 +++ b/base/PlayParameterRepository.h Tue Jan 07 10:57:28 2014 +0000 @@ -51,8 +51,7 @@ void setPlayAudible(bool); void setPlayPan(float); void setPlayGain(float); - void setPlayPluginId(QString); - void setPlayPluginConfiguration(QString); + void setPlaySampleId(QString); void execute(); void unexecute(); QString getName() const; @@ -65,13 +64,11 @@ signals: void playParametersChanged(PlayParameters *); - void playPluginIdChanged(const Playable *, QString); - void playPluginConfigurationChanged(const Playable *, QString); + void playSampleIdChanged(const Playable *, QString); protected slots: void playParametersChanged(); - void playPluginIdChanged(QString); - void playPluginConfigurationChanged(QString); + void playSampleIdChanged(QString); protected: typedef std::map<const Playable *, PlayParameters *> PlayableParameterMap;
--- a/base/PlayParameters.cpp Wed Dec 04 19:30:02 2013 +0000 +++ b/base/PlayParameters.cpp Tue Jan 07 10:57:28 2014 +0000 @@ -43,15 +43,9 @@ changed = true; } - if (m_playPluginId != pp->getPlayPluginId()) { - m_playPluginId = pp->getPlayPluginId(); - emit playPluginIdChanged(m_playPluginId); - changed = true; - } - - if (m_playPluginConfiguration != pp->getPlayPluginConfiguration()) { - m_playPluginConfiguration = pp->getPlayPluginConfiguration(); - emit playPluginConfigurationChanged(m_playPluginConfiguration); + if (m_playSampleId != pp->getPlaySampleId()) { + m_playSampleId = pp->getPlaySampleId(); + emit playSampleIdChanged(m_playSampleId); changed = true; } @@ -64,18 +58,13 @@ QString extraAttributes) const { stream << indent; - stream << QString("<playparameters mute=\"%1\" pan=\"%2\" gain=\"%3\" pluginId=\"%4\" %6") + stream << QString("<playparameters mute=\"%1\" pan=\"%2\" gain=\"%3\" sampleId=\"%4\" %6") .arg(m_playMuted ? "true" : "false") .arg(m_playPan) .arg(m_playGain) - .arg(m_playPluginId) + .arg(m_playSampleId) .arg(extraAttributes); - if (m_playPluginConfiguration != "") { - stream << ">\n " << indent << m_playPluginConfiguration - << "\n" << indent << "</playparameters>\n"; - } else { - stream << "/>\n"; - } + stream << "/>\n"; } void @@ -118,11 +107,11 @@ } void -PlayParameters::setPlayPluginId(QString id) +PlayParameters::setPlaySampleId(QString id) { - if (m_playPluginId != id) { - m_playPluginId = id; - emit playPluginIdChanged(id); + if (m_playSampleId != id) { + m_playSampleId = id; + emit playSampleIdChanged(id); emit playParametersChanged(); } } @@ -130,12 +119,16 @@ void PlayParameters::setPlayPluginConfiguration(QString configuration) { + //!!! need to parse out sample id from e.g. configuration == + //!!! <plugin program="piano"/> +/* if (m_playPluginConfiguration != configuration) { m_playPluginConfiguration = configuration; // cerr << "PlayParameters(" << this << "): setPlayPluginConfiguration to \"" << configuration << "\"" << endl; emit playPluginConfigurationChanged(configuration); emit playParametersChanged(); } +*/ }
--- a/base/PlayParameters.h Wed Dec 04 19:30:02 2013 +0000 +++ b/base/PlayParameters.h Tue Jan 07 10:57:28 2014 +0000 @@ -32,8 +32,7 @@ virtual float getPlayPan() const { return m_playPan; } // -1.0 -> 1.0 virtual float getPlayGain() const { return m_playGain; } - virtual QString getPlayPluginId() const { return m_playPluginId; } - virtual QString getPlayPluginConfiguration() const { return m_playPluginConfiguration; } + virtual QString getPlaySampleId() const { return m_playSampleId; } virtual void copyFrom(const PlayParameters *); @@ -46,8 +45,10 @@ virtual void setPlayAudible(bool nonMuted); virtual void setPlayPan(float pan); virtual void setPlayGain(float gain); - virtual void setPlayPluginId(QString id); - virtual void setPlayPluginConfiguration(QString configuration); + virtual void setPlaySampleId(QString id); + + // Obsolete but retained for file load compatibility + virtual void setPlayPluginConfiguration(QString config); signals: void playParametersChanged(); @@ -55,15 +56,13 @@ void playAudibleChanged(bool); void playPanChanged(float); void playGainChanged(float); - void playPluginIdChanged(QString); - void playPluginConfigurationChanged(QString); + void playSampleIdChanged(QString); protected: bool m_playMuted; float m_playPan; float m_playGain; - QString m_playPluginId; - QString m_playPluginConfiguration; + QString m_playSampleId; private: PlayParameters(const PlayParameters &);
--- a/base/Playable.h Wed Dec 04 19:30:02 2013 +0000 +++ b/base/Playable.h Tue Jan 07 10:57:28 2014 +0000 @@ -24,8 +24,7 @@ virtual ~Playable() { } virtual bool canPlay() const { return false; } - virtual QString getDefaultPlayPluginId() const { return ""; } - virtual QString getDefaultPlayPluginConfiguration() const { return ""; } + virtual QString getDefaultPlaySampleId() const { return ""; } }; #endif
--- a/data/model/DenseTimeValueModel.h Wed Dec 04 19:30:02 2013 +0000 +++ b/data/model/DenseTimeValueModel.h Tue Jan 07 10:57:28 2014 +0000 @@ -22,7 +22,9 @@ /** * Base class for models containing dense two-dimensional data (value - * against time). For example, audio waveform data. + * against time). For example, audio waveform data. Other time-value + * plot data, especially if editable, will normally go into a + * SparseTimeValueModel instead even if regularly sampled. */ class DenseTimeValueModel : public Model
--- a/data/model/NoteData.h Wed Dec 04 19:30:02 2013 +0000 +++ b/data/model/NoteData.h Tue Jan 07 10:57:28 2014 +0000 @@ -26,6 +26,7 @@ size_t start; // audio sample frame size_t duration; // in audio sample frames int midiPitch; // 0-127 +//!!! float: -> what else would this change? int frequency; // Hz, to be used if isMidiPitchQuantized false bool isMidiPitchQuantized; int velocity; // MIDI-style 0-127