wrap midi negative gain for midi-velocity
ignore polarity invert, scale_velocity() otherwise claps the factor to zero.
This commit is contained in:
parent
f9b364c515
commit
c0437aed47
@ -100,7 +100,7 @@ Amp::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/,
|
|||||||
Evoral::MIDIEvent<MidiBuffer::TimeType> ev = *m;
|
Evoral::MIDIEvent<MidiBuffer::TimeType> ev = *m;
|
||||||
if (ev.is_note_on()) {
|
if (ev.is_note_on()) {
|
||||||
assert(ev.time() >= 0 && ev.time() < nframes);
|
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) {
|
for (MidiBuffer::iterator m = mb.begin(); m != mb.end(); ++m) {
|
||||||
Evoral::MIDIEvent<MidiBuffer::TimeType> ev = *m;
|
Evoral::MIDIEvent<MidiBuffer::TimeType> ev = *m;
|
||||||
if (ev.is_note_on()) {
|
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()) {
|
if (ev.is_note_on()) {
|
||||||
const gain_t scale = delta * (ev.time()/(double) nframes);
|
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) {
|
for (MidiBuffer::iterator m = mb.begin(); m != mb.end(); ++m) {
|
||||||
Evoral::MIDIEvent<MidiBuffer::TimeType> ev = *m;
|
Evoral::MIDIEvent<MidiBuffer::TimeType> ev = *m;
|
||||||
if (ev.is_note_on()) {
|
if (ev.is_note_on()) {
|
||||||
ev.scale_velocity (target);
|
ev.scale_velocity (fabsf (target));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user