On Fri, Jan 01, 2021 at 03:20:09PM -0500, Vadim Belman wrote:
> As it seems that Audio::PortMIDI lacks non-blocking interface, I think a
> solution would be to read events in a dedicated thread and re-submit them
> into a Supplier. Something like:
>
> my Supplier $midi-events;
>
> start {
>
I think the simplest way to turn that into a Supply is to use the `supply`
keyword
my $pm = Audio::PortMIDI.new;
my $input = supply {
my $stream = $pm.open-input($input-device-number, 32);
DONE {
$stream.close;
}
loop {
emit
As it seems that Audio::PortMIDI lacks non-blocking interface, I think a
solution would be to read events in a dedicated thread and re-submit them into
a Supplier. Something like:
my Supplier $midi-events;
start {
loop {
my $ev = $midi.read;
$midi-events.emit: $ev;
}
}
I am working on a small virtual organ program, where I have
multiple MIDI controller keyboards which can be connected to one
or more synthesizer channels to emit various sounds
simultaneously.
At this point, I am able to read events from a single MIDI
controller and send the events to the correct