You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Method openPort(portNumber:Int=0, portName:String="RtMidi Input")
bmx_rtmidiin_openPort(midiPtr, portNumber, portName)
End Method
if the rtMidi-openPort fails, it rtMidi-library-internally throws an exception (which you can catch in Blitzmax (as @woollybah handles it) - if you knew it could throw something).
Maybe you should extend openPort to catch the exceptions already and simply return "true" or "false" depending on the result. You might have a simple "GetLastError()" if you want to know what failed.
Think it would be at least a bit more "beginner proof".
I had problems in finding out, whether a MIDI-port is used by another app. In this case the RT-MIDI throws a exception, which your wrapper can handle already. This means following your examples, will result in a crash.
You should update your examples to:
.....
For Local i:Int = 0 Until midiIn.getPortCount()
Print " Input port #" + i + " : " + midiIn.getPortName(i)
Next
Print "Opening " + midiIn.getPortName()
Try
midiIn.openPort(0)
Catch Exception:Object
Print "MIDI IN PROBLEM! port=" + midiIn.getPortName(0)+ " exception message=" + Exception.ToString()
End
End Try
midiIn.ignoreTypes(False, False, False)
....
For now rtMidi's openPort looks like this:
if the rtMidi-openPort fails, it rtMidi-library-internally throws an exception (which you can catch in Blitzmax (as @woollybah handles it) - if you knew it could throw something).
Maybe you should extend openPort to catch the exceptions already and simply return "true" or "false" depending on the result. You might have a simple "GetLastError()" if you want to know what failed.
Think it would be at least a bit more "beginner proof".
PS: coming from this thread there: https://www.syntaxbomb.com/blitzmax-blitzmax-ng/chord-displayer/msg347057737
The text was updated successfully, but these errors were encountered: