summaryrefslogtreecommitdiff
path: root/libs/ardour/amp.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-04-26 02:51:40 +0200
committerRobin Gareus <robin@gareus.org>2015-04-26 02:51:40 +0200
commitc0437aed47b8b2ba6657743143f9b63536708071 (patch)
tree41ae9920140b1f47f5a4e879d4a2a154f04bb445 /libs/ardour/amp.cc
parentf9b364c51550686deb879772673c4d6afd01cec4 (diff)
wrap midi negative gain for midi-velocity
ignore polarity invert, scale_velocity() otherwise claps the factor to zero.
Diffstat (limited to 'libs/ardour/amp.cc')
-rw-r--r--libs/ardour/amp.cc8
1 files changed, 4 insertions, 4 deletions
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<MidiBuffer::TimeType> 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<MidiBuffer::TimeType> 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<MidiBuffer::TimeType> ev = *m;
if (ev.is_note_on()) {
- ev.scale_velocity (target);
+ ev.scale_velocity (fabsf (target));
}
}
}