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

Get client name API ? #54

Closed
stuaxo opened this issue Oct 20, 2015 · 15 comments
Closed

Get client name API ? #54

stuaxo opened this issue Oct 20, 2015 · 15 comments

Comments

@stuaxo
Copy link

stuaxo commented Oct 20, 2015

In alsa I can get the midi client names
alias lsmidi='aplaymidi -l'

 Port    Client name                      Port name
 14:0    Midi Through                     Midi Through Port-0
 20:0    APC MINI                         APC MINI MIDI 1
128:0    TiMidity                         TiMidity port 0
128:1    TiMidity                         TiMidity port 1
128:2    TiMidity                         TiMidity port 2
128:3    TiMidity                         TiMidity port 3

Is there any way to get the client name ? - if not would it be possible to add a way ?

@garyscavone
Copy link
Contributor

Hi Stuart,

If it can be done via aplaymidi, it can be done in RtMidi. The main issue would be finding a way to work it into the existing RtMidi API. I suppose the easiest way might be to add an optional string pointer argument to the getPortName() function that can be filled by the function if the client name is available (not all APIs will support that). So, something like:

std::string getPortName (unsigned int portNumber=0, std::string *clientName=0 )

Regards,

—gary

On Oct 20, 2015, at 10:38 AM, Stuart Axon notifications@github.com wrote:

In alsa I can get the midi client names
alias lsmidi='aplaymidi -l'

Port Client name Port name
14:0 Midi Through Midi Through Port-0
20:0 APC MINI APC MINI MIDI 1
128:0 TiMidity TiMidity port 0
128:1 TiMidity TiMidity port 1
128:2 TiMidity TiMidity port 2
128:3 TiMidity TiMidity port 3

Is there any way to get the client name ? - if not would it be possible to add a way ?


Reply to this email directly or view it on GitHub.

@stuaxo
Copy link
Author

stuaxo commented Nov 5, 2015

I was originally asking for an API in a consuming API (mido), hopefully the author will chip in if this looks good.

@olemb
Copy link

olemb commented Nov 24, 2015

Mido author here.

That should work. I could do something like this in Mido:

get_input_names(client='something')

For this to work we also need to involve the author of python-rtmidi since Mido doesn't use RtMidi directly.

Stuart: This would give you a list of ports for a specific client. Is that what you were looking for or do you need all ports on all clients?

@SpotlightKid
Copy link
Contributor

I'm subscribed to updates on this project.

I've been meaning to do a new python-rtmidi release for quite some time now anyway and to get it out of beta status. I just haven't found the time to write documentation yet.

@stuaxo
Copy link
Author

stuaxo commented Nov 24, 2015

@olemb I think so - I've been making something for the APC MINI ... and when I do aplaymidi -l I get

 Port    Client name                      Port name
 14:0    Midi Through                     Midi Through Port-0
 20:0    APC MINI                         APC MINI MIDI 1
128:0    TiMidity                         TiMidity port 0
128:1    TiMidity                         TiMidity port 1
128:2    TiMidity                         TiMidity port 2
128:3    TiMidity                         TiMidity port 3

so if I could do get_input_names(client='APC MINI ') it should fit... I don't have more than one APC MINI, but reckon it should work.

@olemb
Copy link

olemb commented Dec 1, 2015

@SpotlightKid Awesome! Does the API look OK to you?

@SpotlightKid
Copy link
Contributor

@olemb That should work. I'll just add client_name=None as a keyword arg to rtmidi.MidiIn.get_port_name() and rtmidi.MidiOut.get_port_name() (may raise NotImplementedError if used with the wrong API) and add support for it to rtmidi.midiutil.open_midiport().

If you want, you can open an issue here.

@olemb
Copy link

olemb commented Dec 15, 2015

Sounds good. This will be very easy to add to Mido once it's supported in RtMidi and python-rtmidi.

@SpotlightKid
Copy link
Contributor

So who writes a patch? I'm not really a C/C++ programmer. :)

@SpotlightKid
Copy link
Contributor

Any news on this?

@garyscavone
Copy link
Contributor

Someone needs to work on the implementation and submit a pull request.

@aib
Copy link
Contributor

aib commented Sep 14, 2016

The problem is that RtMidi (and therefore python-rtmidi) already returns client names. Without any port names. On the ALSA (asound) backend, the string returned is of the form "cname cid:pid".

This is also why the python-rtmidi unit tests fail on ALSA.

It would be trivial to change this, but there's no telling what it would break downstream and I wouldn't submit a PR without a green light from an RtMidi developer.

@radarsat1
Copy link
Contributor

It would be trivial to change this, but there's no telling what it would break downstream and I wouldn't submit a PR without a green light from an RtMidi developer.

vs.

Someone needs to work on the implementation and submit a pull request.

Please feel free to submit a PR ;)

@garyscavone
Copy link
Contributor

Not sure where this stands but if it hasn't been fixed by now, it must not be that important.

@stuaxo
Copy link
Author

stuaxo commented Aug 21, 2017

Not sure if it is because of you closing this, but it looks like the upstream patch to return actual port names has just been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants