From 99ea20463e7534ae3673111ac3230c5d0e94fecd Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sun, 26 Jan 2014 14:03:25 +0100 Subject: [PATCH] InstrumentTrack: fixed midiPitch() and added midiPitchRange() --- include/InstrumentTrack.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/InstrumentTrack.h b/include/InstrumentTrack.h index 0217cb19a..4057d7990 100644 --- a/include/InstrumentTrack.h +++ b/include/InstrumentTrack.h @@ -34,6 +34,7 @@ #include "note_play_handle.h" #include "Piano.h" #include "PianoView.h" +#include "Pitch.h" #include "track.h" @@ -111,7 +112,13 @@ public: // translate pitch to midi-pitch [0,16383] int midiPitch() const { - return (int)( ( m_pitchModel.value()+100 ) * 16383 ) / 200; + return static_cast( ( ( m_pitchModel.value() + m_pitchModel.range()/2 ) * MidiMaxPitchBend ) / m_pitchModel.range() ); + } + + /*! \brief Returns current range for pitch bend in semitones */ + int midiPitchRange() const + { + return m_pitchRangeModel.value(); } // play everything in given frame-range - creates note-play-handles