Bug 231 - PROGRAM CHANGE midi message ignored
Summary: PROGRAM CHANGE midi message ignored
Status: CLOSED FIXED
Alias: None
Product: LinuxSampler
Classification: Unclassified
Component: other (show other bugs)
Version: unspecified
Hardware: PC Windows 8
: P5 major
Assignee: Christian Schoenebeck
URL:
Depends on:
Blocks:
 
Reported: 2014-08-24 14:28 CEST by Tomas Bures
Modified: 2016-07-25 18:52 CEST (History)
0 users

See Also:


Attachments
Proposed fix. (1.69 KB, patch)
2014-09-03 21:56 CEST, Christian Schoenebeck
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Bures 2014-08-24 14:28:26 CEST
When two program change messages for two different channels are sent in quick succession, the first one is ignored.

To reproduce:

- Create an instrument map with two programs (0, 1)
- Create two sampler channels, assign one to MIDI channel 0, assign the other to MIDI channel 1
- Assign the instrument map to both the sampler channels
- Send these two MIDI messages to linuxsampler <192, 1, 0>, <193, 1, 0>

As the result, linux sampler changes the program (i.e. loads the instrument) only on the second sampler channel (i.e. for the message <193, 1, 0>).

If however there is about 100ms delay between the two MIDI messages, everything works fine.

Thank you,
Tomas
Comment 1 Christian Schoenebeck 2014-08-24 18:43:14 CEST
Yes, I am aware about this bug. It is hanging around for a while now. And I also tried to investigate it once, but could not find the root cause of this misbehavior. The problem is that quite some amount of code base involved in processing those program change messages and it is not that easy to debug it. There are several threads, FIFOs and a bunch of classes involved.
Comment 2 Christian Schoenebeck 2014-09-03 21:56:51 CEST
Created attachment 70 [details]
Proposed fix.

Please try this patch (apply it against latest LinuxSampler SVN version).
Comment 3 Tomas Bures 2014-09-04 00:11:27 CEST
(In reply to comment #2)
> Created attachment 70 [details]
> Proposed fix.
> 
> Please try this patch (apply it against latest LinuxSampler SVN version).

I'm using LinuxSampler on Windows, thus it's a bit difficult for me to recompile it. I more or less followed the instructions on https://www.linuxsampler.org/msys.html, but in the end (after all compiled successfully), the linuxsampler crashes for some reason. I would guess it's connected to some incompatibilities in the libraries (i.e. not worth investigating). Would it be possible for you to send me a Windows binary please? Alternatively, I may try Linux in VMWare.

Thank you.
T.
Comment 4 Christian Schoenebeck 2014-09-04 01:13:40 CEST
Fastest solution would be if you try the patch out on Linux. I'm rarely using Windows and the Windows binaries of LinuxSampler are automatically build by our server once something new was commited to SVN. However I don't want to commit this yet to SVN before it has been tested.
Comment 5 Tomas Bures 2014-09-04 16:42:36 CEST
(In reply to comment #4)
> Fastest solution would be if you try the patch out on Linux. I'm rarely using
> Windows and the Windows binaries of LinuxSampler are automatically build by our
> server once something new was commited to SVN. However I don't want to commit
> this yet to SVN before it has been tested.

Thank you Christian. I'll try it and report the result. 
T.
Comment 6 Christian Schoenebeck 2014-09-06 15:16:51 CEST
I made a short test and it seems the patch has solved this issue. So I commited it now to SVN. A new Windows snapshot (with this fix) should be available for you in a few minutes.

What you could test though, is whether it also works for sending program changes messages simultaniously for 16 sampler parts or more. If it only works for i.e. 10 parts or so, then it might be that some buffer somewhere is still too small.
Comment 7 Tomas Bures 2014-09-08 09:09:35 CEST
Dear Christian,

I've tested it with simultaneous program change on 16 channels. It seems to work. Perfect! Thank you.
Tomas