13
0

Fix issues when using MIDI sends with small buffersizes

MIDI data buffers are fixed size, independent of the engine's
buffersize (compare to ThreadBuffers::ensure_buffers)
This commit is contained in:
Robin Gareus 2021-08-07 23:36:59 +02:00
parent 8cf7204917
commit 5e1f2d21f8
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 14 additions and 4 deletions

View File

@ -83,6 +83,7 @@ private:
void init_gain (); void init_gain ();
int use_target (boost::shared_ptr<Route>, bool update_name = true); int use_target (boost::shared_ptr<Route>, bool update_name = true);
void target_io_changed (); void target_io_changed ();
void ensure_mixbufs ();
void propagate_solo (); void propagate_solo ();
}; };

View File

@ -159,7 +159,7 @@ InternalSend::use_target (boost::shared_ptr<Route> sendto, bool update_name)
_send_to->add_send_to_internal_return (this); _send_to->add_send_to_internal_return (this);
mixbufs.ensure_buffers (_send_to->internal_return ()->input_streams (), _session.get_block_size ()); ensure_mixbufs ();
mixbufs.set_count (_send_to->internal_return ()->input_streams ()); mixbufs.set_count (_send_to->internal_return ()->input_streams ());
_meter->configure_io (ChanCount (DataType::AUDIO, pan_outs ()), ChanCount (DataType::AUDIO, pan_outs ())); _meter->configure_io (ChanCount (DataType::AUDIO, pan_outs ()), ChanCount (DataType::AUDIO, pan_outs ()));
@ -186,7 +186,7 @@ void
InternalSend::target_io_changed () InternalSend::target_io_changed ()
{ {
assert (_send_to); assert (_send_to);
mixbufs.ensure_buffers (_send_to->internal_return ()->input_streams (), _session.get_block_size ()); ensure_mixbufs ();
mixbufs.set_count (_send_to->internal_return ()->input_streams ()); mixbufs.set_count (_send_to->internal_return ()->input_streams ());
reset_panner (); reset_panner ();
} }
@ -344,11 +344,20 @@ out:
_active = _pending_active; _active = _pending_active;
} }
void
InternalSend::ensure_mixbufs ()
{
for (DataType::iterator t = DataType::begin (); t != DataType::end (); ++t) {
size_t size = (*t == DataType::MIDI) ? _session.engine ().raw_buffer_size (*t) : _session.get_block_size ();
mixbufs.ensure_buffers (*t, _send_to->internal_return ()->input_streams ().get (*t), size);
}
}
int int
InternalSend::set_block_size (pframes_t nframes) InternalSend::set_block_size (pframes_t)
{ {
if (_send_to) { if (_send_to) {
mixbufs.ensure_buffers (_send_to->internal_return ()->input_streams (), nframes); ensure_mixbufs ();
} }
return 0; return 0;