From ba324f4aa86ef6362b0338b35dedc50ef2e5e42a Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sat, 8 Mar 2014 12:55:14 +0100 Subject: [PATCH] InstrumentTrack: scale output volume by 2 for MIDI-based instruments As of 0ca3901ab86006d775125f6a5caf70d873bf008b MIDI-based instruments are played at velocity 63 for volume=100%. In order to get the same output volume, we need to scale it by 2. --- src/tracks/InstrumentTrack.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 9f5153a3b..33aff61dd 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -185,6 +185,13 @@ void InstrumentTrack::processAudioBuffer( sampleFrame* buf, const fpp_t frames, float v_scale = (float) getVolume() / DefaultVolume; + // We play MIDI-based instruments at velocity 63 for volume=100%. In order + // to get the same output volume, we need to scale it by 2 + if( m_instrument->flags().testFlag( Instrument::IsMidiBased ) ) + { + v_scale *= 2; + } + // instruments using instrument-play-handles will call this method // without any knowledge about notes, so they pass NULL for n, which // is no problem for us since we just bypass the envelopes+LFOs