From c0437aed47b8b2ba6657743143f9b63536708071 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 26 Apr 2015 02:51:40 +0200 Subject: wrap midi negative gain for midi-velocity ignore polarity invert, scale_velocity() otherwise claps the factor to zero. --- libs/ardour/amp.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libs/ardour/amp.cc') diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc index 07f79ed5a8..28f8729436 100644 --- a/libs/ardour/amp.cc +++ b/libs/ardour/amp.cc @@ -100,7 +100,7 @@ Amp::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, Evoral::MIDIEvent ev = *m; if (ev.is_note_on()) { assert(ev.time() >= 0 && ev.time() < nframes); - ev.scale_velocity (gab[ev.time()]); + ev.scale_velocity (fabsf (gab[ev.time()])); } } } @@ -146,7 +146,7 @@ Amp::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, for (MidiBuffer::iterator m = mb.begin(); m != mb.end(); ++m) { Evoral::MIDIEvent ev = *m; if (ev.is_note_on()) { - ev.scale_velocity (_current_gain); + ev.scale_velocity (fabsf (_current_gain)); } } } @@ -199,7 +199,7 @@ Amp::apply_gain (BufferSet& bufs, framecnt_t sample_rate, framecnt_t nframes, ga if (ev.is_note_on()) { const gain_t scale = delta * (ev.time()/(double) nframes); - ev.scale_velocity (initial+scale); + ev.scale_velocity (fabsf (initial+scale)); } } } @@ -335,7 +335,7 @@ Amp::apply_simple_gain (BufferSet& bufs, framecnt_t nframes, gain_t target, bool for (MidiBuffer::iterator m = mb.begin(); m != mb.end(); ++m) { Evoral::MIDIEvent ev = *m; if (ev.is_note_on()) { - ev.scale_velocity (target); + ev.scale_velocity (fabsf (target)); } } } -- cgit v1.2.3