# HG changeset patch # User Chris Cannam # Date 1389109779 0 # Node ID 9196cff56abe5793706b7c69aa816c4aeebe92e3 # Parent 6d07bcc844a1deb03497cf490aad03d6daf2275e SV file compatibility etc for sample stuff diff -r 6d07bcc844a1 -r 9196cff56abe base/PlayParameters.cpp --- 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("\n") + .arg("sample_player") + .arg(m_playSampleId); + } + + stream << indent << "\n"; } void @@ -115,20 +126,3 @@ emit playParametersChanged(); } } - -void -PlayParameters::setPlayPluginConfiguration(QString configuration) -{ - //!!! need to parse out sample id from e.g. configuration == - //!!! -/* - if (m_playPluginConfiguration != configuration) { - m_playPluginConfiguration = configuration; -// cerr << "PlayParameters(" << this << "): setPlayPluginConfiguration to \"" << configuration << "\"" << endl; - emit playPluginConfigurationChanged(configuration); - emit playParametersChanged(); - } -*/ -} - - diff -r 6d07bcc844a1 -r 9196cff56abe base/PlayParameters.h --- 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(); diff -r 6d07bcc844a1 -r 9196cff56abe data/model/NoteData.h --- 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 +#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 NoteList;