Bug 112 - Not processed note off events
Summary: Not processed note off events
Status: CLOSED FIXED
Alias: None
Product: LinuxSampler
Classification: Unclassified
Component: gig::Engine (show other bugs)
Version: SVN Trunk
Hardware: PC Linux
: P2 normal
Assignee: Christian Schoenebeck
URL:
Depends on:
Blocks:
 
Reported: 2008-12-14 23:50 CET by Grigor Iliev
Modified: 2009-03-09 19:31 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Grigor Iliev 2008-12-14 23:50:32 CET
When note on and note off events for same note are processed in one call of
EngineChannel::ImportEvents the note continue to play.
To reproduce it, just drag the mouse over the virtual keyboard.
Comment 1 Christian Schoenebeck 2008-12-16 13:26:08 CET
Release critical? :-)
Comment 2 Grigor Iliev 2008-12-16 16:16:41 CET
Not too critical, but it's very annoying when you play on the keyboard by 
dragging the mouse :)
Comment 3 Christian Schoenebeck 2009-03-02 15:57:40 CET
I currently can't spot the problem. The events are handled in the sequence 
they arrive from the input queue. So even if a note-on / note-off event pair 
arrives with the same time stamp, the note-off event should be sent by the 
MIDI source after the note-on event, so everything should be right.

I don't have a recent Java version installed on this Linux box right now, so I 
couldn't test it with JSampler yet.

Any hints?
Comment 4 Grigor Iliev 2009-03-02 16:53:02 CET
(In reply to comment #3)
> I don't have a recent Java version installed on this Linux box right now, so I 
> couldn't test it with JSampler yet.
> 
> Any hints?

You can try with a lscp script like:
SEND CHANNEL MIDI_DATA NOTE_ON 0 60 100
SEND CHANNEL MIDI_DATA NOTE_OFF 0 60 100
SEND CHANNEL MIDI_DATA NOTE_ON 0 61 100
SEND CHANNEL MIDI_DATA NOTE_OFF 0 61 100
SEND CHANNEL MIDI_DATA NOTE_ON 0 62 100
SEND CHANNEL MIDI_DATA NOTE_OFF 0 62 100
SEND CHANNEL MIDI_DATA NOTE_ON 0 63 100
SEND CHANNEL MIDI_DATA NOTE_OFF 0 63 100

It reproduces the bug well with PMI Bosendorfer 290 instrument

Comment 5 Christian Schoenebeck 2009-03-07 20:26:03 CET
I just commited a fix to CVS.
Comment 6 Andreas Persson 2009-03-08 17:50:03 CET
Still doesn't work quite right. Dragging the mouse over the keyboard in Fantasia
still leaves playing notes.
Comment 7 Christian Schoenebeck 2009-03-08 20:47:52 CET
I just tested it with gigedit's virtual keyboard and with the previous LSCP 
commands and the problem was solved for me. Unfortunately I can't reproduce it 
right now with JSampler, due to the mentioned old Java version.
Comment 8 Grigor Iliev 2009-03-08 21:35:17 CET
(In reply to comment #6)
> Still doesn't work quite right. Dragging the mouse over the keyboard in Fantasia
> still leaves playing notes.

Note that the virtual midi device event limit is 12 (MAX_EVENTS  12). So if you drag the mouse very fast 
(over 6 notes per cycle)  LS may ignore some events. But maybe this is not your case. For me this fix is 
working fairly well.
Comment 9 Andreas Persson 2009-03-09 07:39:22 CET
(In reply to comment #8)
> Note that the virtual midi device event limit is 12 (MAX_EVENTS  12). So if
you drag the mouse very fast 
> (over 6 notes per cycle)  LS may ignore some events.

Yes, that was indeed my problem. I changed MAX_EVENTS to 1000 and now the
problem is gone.

Comment 10 Christian Schoenebeck 2009-03-09 10:44:32 CET
So what would be a reasonable value for MAX_EVENTS in VirtualMidiDevice.cpp?
Comment 11 Grigor Iliev 2009-03-09 10:57:18 CET
(In reply to comment #10)
> So what would be a reasonable value for MAX_EVENTS in VirtualMidiDevice.cpp?

I would propose something like 64, but lets see how fast is Andreas :)
Comment 12 Andreas Persson 2009-03-09 19:31:00 CET
Sorry, I must have done something stupid, like running an older version of LS
than I thought I was. Today it works fine, even with MAX_EVENTS 12.