Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[upstream] RtMidi: opening midi device causes device count inflation #1

Open
atsushieno opened this issue Mar 6, 2016 · 0 comments

Comments

@atsushieno
Copy link
Owner

This is an upstream issue (could be up to ALSA) but the proof of concept issue shows up in RtMidi:

#include "RtMidi.h"
#include <stdio.h>
#include <iostream>
#include <vector>

using namespace std;

int main ()
{
    vector<RtMidi::Api> apis;
    RtMidi::getCompiledApi (apis);
    cout << "apis: " << apis.size() << endl;
    RtMidiIn *input = new RtMidiIn (apis[0], "input");
    RtMidiOut *output = new RtMidiOut (apis[0], "output");
    cout << "before opening port: inputs: " << input->getPortCount ()
         << " outputs: " << output->getPortCount () << endl;
    output->openPort (0, "port0");
    cout << "after opening port: inputs: " << input->getPortCount ()
         << " outputs: " << output->getPortCount () << endl;
    output->closePort ();
    cout << "after closing port: inputs: " << input->getPortCount ()
         << " outputs: " << output->getPortCount () << endl;
    cout << "after opening port: inputs: " << input->getPortCount ()
         << " outputs: " << output->getPortCount () << endl;

    delete input;
    delete output;
    return 0;
}

$ g++ -I/devel/include/rtmidi -L/devel/lib testrtmidi.c -lasound -lpthread -lrtmidi

$ ./a.out
apis: 1
before opening port: inputs: 1 outputs: 2
after opening port: inputs: 2 outputs: 2
after closing port: inputs: 2 outputs: 2
after opening port: inputs: 2 outputs: 2

(Note that it should NOT increase the input port count.)

This affects our managed bindings too. Basically it messes RtMidiAccess and descendants.

The problem however does not seem to be in RtMidi. I get similar results from PortMidiAccess either. So it's more likely in the underlying layer like ALSA I'm on (Ubuntu 14.04). No idea where the problem lies.

So far, without fixes, things don't get work appropriately (it doesn't for me).

@atsushieno atsushieno changed the title [upstream] opening midi device causes device count inflation [upstream] RtMidi: opening midi device causes device count inflation Jan 7, 2018
@atsushieno atsushieno added the bug label Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant