modify Delivery::maybe_merge_midi_mute() to allow forcing the merge
In an internal send, this may be called with _current_gain not yet at zero. So provide an extra argument to force the merge.
This commit is contained in:
@@ -160,7 +160,7 @@ protected:
|
||||
std::shared_ptr<Amp> _amp;
|
||||
|
||||
gain_t target_gain ();
|
||||
void maybe_merge_midi_mute (BufferSet&);
|
||||
void maybe_merge_midi_mute (BufferSet&, bool always);
|
||||
|
||||
private:
|
||||
bool _no_outs_cuz_we_no_monitor;
|
||||
|
||||
@@ -281,14 +281,14 @@ Delivery::configure_io (ChanCount in, ChanCount out)
|
||||
}
|
||||
|
||||
void
|
||||
Delivery::maybe_merge_midi_mute (BufferSet& bufs)
|
||||
Delivery::maybe_merge_midi_mute (BufferSet& bufs, bool always)
|
||||
{
|
||||
if (bufs.available().n_midi()) {
|
||||
|
||||
int mask = _midi_mute_mask.load(); /* atomic */
|
||||
MidiBuffer& pmbuf (bufs.get_midi (0));
|
||||
|
||||
if (mask && (_current_gain < GAIN_COEFF_SMALL)) {
|
||||
if ((always || mask) && (_current_gain < GAIN_COEFF_SMALL)) {
|
||||
|
||||
/* mask set, and we have just been muted */
|
||||
|
||||
@@ -296,7 +296,7 @@ Delivery::maybe_merge_midi_mute (BufferSet& bufs)
|
||||
|
||||
for (uint8_t channel = 0; channel <= 0xF; channel++) {
|
||||
|
||||
if ((1<<channel) & mask) {
|
||||
if (always || ((1<<channel) & mask)) {
|
||||
|
||||
uint8_t buf[3] = { ((uint8_t) (MIDI_CMD_CONTROL | channel)), MIDI_CTL_SUSTAIN, 0 };
|
||||
Evoral::Event<samplepos_t> ev (Evoral::MIDI_EVENT, 0, 3, buf);
|
||||
@@ -388,7 +388,7 @@ Delivery::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample
|
||||
_amp->run (bufs, start_sample, end_sample, speed, nframes, true);
|
||||
}
|
||||
|
||||
maybe_merge_midi_mute (bufs);
|
||||
maybe_merge_midi_mute (bufs, false);
|
||||
|
||||
RTABufferListPtr rtabuffers = _rtabuffers;
|
||||
if (_rta_active.load () && rtabuffers && !rtabuffers->empty ()) {
|
||||
|
||||
@@ -333,7 +333,7 @@ InternalSend::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa
|
||||
Amp::apply_simple_gain (mixbufs, nframes, tgain);
|
||||
}
|
||||
|
||||
maybe_merge_midi_mute (mixbufs);
|
||||
maybe_merge_midi_mute (mixbufs, tgain == GAIN_COEFF_ZERO);
|
||||
|
||||
/* apply fader gain automation */
|
||||
_amp->set_gain_automation_buffer (_session.send_gain_automation_buffer ());
|
||||
|
||||
Reference in New Issue
Block a user