Skip to content

Allow multiple instances to open the same port #1

@hrueger

Description

@hrueger

Hi @Julusian,
I thought I'd open the issue here and not in the PR, since it has nothing to do with the rewrite.

In my application, I have multiple plugins each running in its own worker_thread. I'd like all those plugins to have access to all the midi ports. Currently, if one port is already opened in one worker_thread, it's not possible to open it again from another worker_thread but instead get the following error:


MidiInWinMM::openPort: error creating Windows MM MIDI input port.

Error: Internal RtMidi error

This goes for Inputs as well as for Outputs.

It would be cool if node-midi could allow that. Maybe node-midi can hold all the internal RtMidi Inputs and Outputs in a global scope, open them if port.openPort(idx) is called for the first time and just reuse that port if port.openPort(idx) is called again?
Incoming Messages would be forwarded to all Inputs, outgoing Messages would be send to the single output.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions