Re: Beatrix ignores noteoffs

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

 



On Mon, 2011-10-03 at 17:19 -0400, S. Massy wrote:
> Hello,
> 
> I got Beatrix patched and running, but it doesn't seem to receive/honour
> noteoffs: so notes don't decay.

I had the same problem. Actually Beatrix does honor noteoff, but it does
not treat noteon with velocity=0 as noteoff. Try the attached patch.

-- 
Roy Vegard

diff --git a/beatrix b/beatrix
deleted file mode 100755
index 1d37d0d..0000000
Binary files a/beatrix and /dev/null differ
diff --git a/midi.c b/midi.c
index a9393cb..d414064 100644
--- a/midi.c
+++ b/midi.c
@@ -1142,12 +1142,18 @@ void process_seq_event(const snd_seq_event_t *ev) {
   // see "snd_seq_event_type" file:///usr/share/doc/libasound2-doc/html/group___seq_events.html
   switch(ev->type) {
     case SND_SEQ_EVENT_NOTEON:
-      //printf("DEBUG KEY on %i %i\n",ev->data.note.channel, ev->data.note.note);
-      keyTable = (unsigned char *) statusTable[MIDI_NOTEON|ev->data.note.channel].handback;
-      oscKeyOn (keyTable[ev->data.note.note]);
+      printf("DEBUG KEY on %i %i %i\n",ev->data.note.channel, ev->data.note.note, ev->data.note.velocity);
+      if (ev->data.note.velocity < 1) {
+         keyTable = (unsigned char *) statusTable[MIDI_NOTEOFF|ev->data.note.channel].handback;
+         oscKeyOff (keyTable[ev->data.note.note]);
+      }
+      else if (ev->data.note.velocity > 0){
+         keyTable = (unsigned char *) statusTable[MIDI_NOTEON|ev->data.note.channel].handback;
+         oscKeyOn (keyTable[ev->data.note.note]);
+      }
       break;
     case SND_SEQ_EVENT_NOTEOFF:
-      //printf("DEBUG KEY off %i %i\n",ev->data.note.channel, ev->data.note.note);
+      printf("DEBUG KEY off %i %i\n",ev->data.note.channel, ev->data.note.note);
       keyTable = (unsigned char *) statusTable[MIDI_NOTEOFF|ev->data.note.channel].handback;
       oscKeyOff (keyTable[ev->data.note.note]);
       break;
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
http://lists.linuxaudio.org/listinfo/linux-audio-user

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux