-
Notifications
You must be signed in to change notification settings - Fork 72
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
open port by name on windows #21
Comments
Are you absolutely sure? That's really weird and sounds like a problem with RtMidi which is supposedly returning a C++ string. Maybe there's a stray endline char in there or something ... |
Hi - just came across this issue as well. It does indeed seem to be a bug with rtMidi. It is somehow inserting a NULL into the middle of the string, which creates an invalid std::string object. My MIDI device is called "loopMidi Port" and rtMidi should report it as "loopMidi Port 0". However, the actual string it returns (in hex) is this: As you can see, there is a terminator (zero) after the 74 (the t in "Port") as well as after the " 0" (20 30). |
Maybe it's something in the RtMidiOut Windows Unicode conversion. Can you try commenting out some lines starting here: https://github.com/danomatika/ofxMidi/blob/master/libs/rtmidi/RtMidi.cpp#L2210 So this:
Becomes this:
I have a feeling the assign(length, 0); is the culprit ... |
Also, does "loopMidi Port 1" etc return ok? Maybe the numbers are coming through in their decimal values instead of ascii chars aka 0 as 0 instead of 48. |
Sorry just realised you're talking about Midi out whereas I'm only using Midi in. The issue appears to be the same, however there are some differences in how the function is implemented
I think I've found the source of the bug though, and it arises through a misuse of the std::string::assign function.
When Down the line this causes problems because comparing two c-strings for equality will check up until the first null character is found, whereas comparing two std::strings for equality will compare all characters up until the length of the string. So... the bug is easily fixed - simply change line 2136 from
to
I've just submitted a PR to do that. |
Thanks! I figured was something simple like that. I'll forward this upstream to the RtMidi Developer. Also, have you tried the Windows Kernel Streaming api as well? It's supposed to have better performance and I'd like to be sure it doesn't have the same problem, although from looking at the getPortName impelmentations it looks ok (no unicode conversions). Change the define on this line: https://github.com/danomatika/ofxMidi/blob/master/src/ofxMidiConstants.h#L21 to
Thanks. If the KS driver works better, I'll change it be the default driver on Win. |
hey, I am having this same problem. I want to fix the midi in port selection by name, because sometimes it changes his number position. But: the position number appears listed too in the port name. I can connect by name: or number: that's the listing:
Any chance to solve this? |
Try updating RTMidi.
enohp ym morf tnes
-----------
Dan Wilcox
danomatika.com
robotcowboy.com
… On Aug 19, 2018, at 3:24 PM, moebiussurfing ***@***.***> wrote:
hey, I am having this same problem. I want to fix the midi in port selection by name, because sometimes it changes his number position.
But: the position number appears listed too in the port name.
I can connect by name:
midiIn.openPort("loopMIDI Port 1 7");
or number:
midiIn_CLOCK.openPort(7);
that's the listing:
[notice ] ofxMidiIn: 8 ports available
[notice ] ofxMidiIn: 0: Automap Propellerhead Mixer 0
[notice ] ofxMidiIn: 1: Automap Propellerhead 1
[notice ] ofxMidiIn: 2: Automap MIDI 2
[notice ] ofxMidiIn: 3: 3- ReMOTE SL Compact 3
[notice ] ofxMidiIn: 4: MIDIIN2 (3- ReMOTE SL Compact) 4
[notice ] ofxMidiIn: 5: MIDIIN3 (3- ReMOTE SL Compact) 5
[notice ] ofxMidiIn: 6: loopMIDI Port 6
[notice ] ofxMidiIn: 7: loopMIDI Port 1 7
[notice ] connected to MIDI CLOCK IN port 7
Any chance to solve this?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
ok @danomatika, thanks |
i found this: |
I cloned the repo https://github.com/thestk/rtmidi, and replaced the \openframeworks\addons\ofxMidi\libs\rtmidi |
Hmmm nope. doesn't works like that, Maybe I should compile the sources, to modificate the ofxMidi or something... :(
i see the openframeworks\addons\ofxMidi\scripts, seems for the release states,,, but I dunno how to continue for the up to date branch repo. |
RtMidi.h is modified for ofMidi. You need to include ofxMidiConstants.h somewhere around line 150.
enohp ym morf tnes
-----------
Dan Wilcox
danomatika.com
robotcowboy.com
… On Aug 31, 2018, at 8:55 PM, moebiussurfing ***@***.***> wrote:
Hmmm nope. doesn't works like that, Maybe I should compile the sources, to modificate the ofxMidi or something...
MidiOutDummy: This class provides no functionality.
MidiInDummy: This class provides no functionality.
MidiOutDummy: This class provides no functionality.
MidiInDummy: This class provides no functionality.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
ok. thanks! it worked adding the line. |
It seems there's some changes to new RtMidi thestk/rtmidi#30 :
Now the ports can be handled with something like port description (getPortDescriptor) By using the same methods it works the same: |
thestk/rtmidi#30 is not „new“ RtMidi, yet. Currently it is more or less a fork that proposes to solve the problems above. Reviews and discussions about the changes are very welcome. |
Didn't have a chance to dig into this, but on Windows 7 I couldn't get ports to be opened by their name.
bool ofxRtMidiOut::openPort(string deviceName)
The equality operator was failing on the string comparison in this method. My hacked fix was to convert them to c style strings and use strcmp.
The text was updated successfully, but these errors were encountered: