[beast: 6/8] BSE: bsemidireceiver.cc: assert there's only one VoiceInput per voice at maximum



commit 304e00a35e13a31a9e627fe42210b3927f20066b
Author: Tim Janik <timj gnu org>
Date:   Wed Mar 15 01:12:47 2017 +0100

    BSE: bsemidireceiver.cc: assert there's only one VoiceInput per voice at maximum
    
    Signed-off-by: Tim Janik <timj gnu org>

 bse/bsemidireceiver.cc |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/bse/bsemidireceiver.cc b/bse/bsemidireceiver.cc
index bd2da65..321ff71 100644
--- a/bse/bsemidireceiver.cc
+++ b/bse/bsemidireceiver.cc
@@ -1146,8 +1146,7 @@ MidiChannel::kill_notes (guint64       tick_stamp,
 }
 
 void
-MidiChannel::debug_notes (guint64          tick_stamp,
-                          BseTrans        *trans)
+MidiChannel::debug_notes (guint64 tick_stamp, BseTrans *trans)
 {
   MidiChannel *mchannel = this;
   guint i, j;
@@ -1694,6 +1693,7 @@ bse_midi_receiver_create_sub_voice (BseMidiReceiver   *self,
   BSE_MIDI_RECEIVER_LOCK ();
   mchannel = self->get_channel (midi_channel);
   vswitch = voice_id < mchannel->n_voices ? mchannel->voices[voice_id] : NULL;
+  uint n = 0;
   if (vswitch)
     {
       guint i = vswitch->n_vinputs++;
@@ -1701,8 +1701,10 @@ bse_midi_receiver_create_sub_voice (BseMidiReceiver   *self,
       vswitch->vinputs[i] = create_voice_input_L (&mchannel->voice_input_table, FALSE, trans);
       vswitch->ref_count++;
       module = vswitch->vinputs[i]->fmodule;
+      n = vswitch->n_vinputs;
     }
   BSE_MIDI_RECEIVER_UNLOCK ();
+  assert_return (n <= 1, module); // we don't actually ever create more than one vinput per vswitch
   return module;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]