Mercurial > hg > svcore
changeset 865:9196cff56abe tonioni
SV file compatibility etc for sample stuff
author | Chris Cannam |
---|---|
date | Tue, 07 Jan 2014 15:49:39 +0000 |
parents | 6d07bcc844a1 |
children | 3a3541b357fe |
files | base/PlayParameters.cpp base/PlayParameters.h data/model/NoteData.h |
diffstat | 3 files changed, 23 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/base/PlayParameters.cpp Tue Jan 07 13:09:53 2014 +0000 +++ b/base/PlayParameters.cpp Tue Jan 07 15:49:39 2014 +0000 @@ -64,7 +64,18 @@ .arg(m_playGain) .arg(m_playSampleId) .arg(extraAttributes); - stream << "/>\n"; + + stream << ">\n"; + + if (m_playSampleId != "") { + // for backward compatibility + stream << indent << " "; + stream << QString("<plugin identifier=\"%1\" program=\"%2\"/>\n") + .arg("sample_player") + .arg(m_playSampleId); + } + + stream << indent << "</playparameters>\n"; } void @@ -115,20 +126,3 @@ emit playParametersChanged(); } } - -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 Tue Jan 07 13:09:53 2014 +0000 +++ b/base/PlayParameters.h Tue Jan 07 15:49:39 2014 +0000 @@ -46,9 +46,6 @@ virtual void setPlayPan(float pan); virtual void setPlayGain(float gain); virtual void setPlaySampleId(QString id); - - // Obsolete but retained for file load compatibility - virtual void setPlayPluginConfiguration(QString config); signals: void playParametersChanged();
--- a/data/model/NoteData.h Tue Jan 07 13:09:53 2014 +0000 +++ b/data/model/NoteData.h Tue Jan 07 15:49:39 2014 +0000 @@ -17,6 +17,8 @@ #include <vector> +#include "base/Pitch.h" + struct NoteData { NoteData(size_t _start, size_t _dur, int _mp, int _vel) : @@ -26,10 +28,17 @@ 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 + float frequency; // Hz, to be used if isMidiPitchQuantized false bool isMidiPitchQuantized; int velocity; // MIDI-style 0-127 + + float getFrequency() const { + if (isMidiPitchQuantized) { + return Pitch::getFrequencyForPitch(midiPitch); + } else { + return frequency; + } + } }; typedef std::vector<NoteData> NoteList;