-
Notifications
You must be signed in to change notification settings - Fork 275
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
Implement a reliable port selection API (official pull request against winks branch) #27
base: winks
Are you sure you want to change the base?
Conversation
When #30 is applied this one can be closed, too. |
Hi Tobias, I made a clone of the rtmidi repo and then checked out your branch (keinstein-portdescriptor-api). After running configure and typing “make,” I get the following compiler warnings and errors: g++ -O3 -Wall -Wextra -Iinclude -fPIC -D__MACOSX_CORE__ -c RtMidi.cpp -o RtMidi.o Is this code incomplete or did I miss something? Regards, —gary On May 3, 2014, at 5:45 AM, keinstein notifications@github.com wrote:
|
You and your compiler are right there were some errors. But my Mac doesn't complain about them. They should have been fixed, now. As my Mac is still on 10.5 (and I don't have access to a newer one), I can't check everything against new compilers on Mac OS X. If you find similar errors and warnings it's probably faster if you fix them yourself if the solution is obvious. In any case I'm glad to help if I can. Another question: You asked me to provide a patch against master. But you replied to the patch against the winks branch. I'm afraid, this could lead to further confusion (and problems on your side), but I'm not shure. Could you be so kind and use #30 for any further conversation? |
@keinstein didn't test it extensively but did a quick |
@drewish Did you also check the |
Is there still any interest in getting this PR merged? The improved port selection API would be pretty helpful for me. |
This pull request involves a lot of changes and I haven’t had time to adequately evaluate it. I was hoping the user community might provide some evaluation and feedback on the possible changes. As always, the goal is to keep the code as simple, yet efficient as possible. If people want to give the change a try and provide some feedback, that would help me out. —gary
|
Sounds like an chicken and egg problem to me. I plan to use this API in my own projects and maintain the fork at https://github.com/keinstein/rtmidi until it can be merged. @mbeards , I think it would be helpful for all of us if you try this out and share your experiences with us, either as bug reports there or by commenting in this thread. Regarding the code: The compatibility functions simply use the old code, so far. This is the efficient way, as it allows to open/close ports in O(1) on Windows or Mac OS (at least the user code part). The simple solution would provide system independent functions similar to those from the JACK backend, which have an open complexity of O(n) where n is the number of available MIDI devices. On windows this should not be a big issue as n cannot grow very large (at most 16, if I'm not mistaken). Another compitibilty issue is the usage of smart pointers. Even though the patch uses the ones that have been added to the C++ standard, not all compilers support this by default, yet. The compatibilty class can be removed if you drop the compatibilty with old compilers or (probably the better option) rely on Boost for the older C++ standards. The standard smart pointer API is a subset of the Boost API. |
MidiInAlsa::openPort MidiInAlsa::getPortList MidiOutAlsa::getPortList Now, we can do some first tests. Test files follow…
This was broken as we use ALSA addresses to store port ids, now. These are stored as unsigned values.
Signed-off-by: Tobias Schlemmer <keinstein@users.sourcforge.net>
WinMM does not support a good port selection scheme. At least wine seems to ensure reliable port ids.
Using temporary objects to store CFStringRef has some advantages: * Use less arguments * Avoid unnecessary copies * Automatic deallocation
avoid copies of size # Conflicts: # RtMidi.cpp # RtMidi.h
# Conflicts: # RtMidi.cpp # RtMidi.h
# Conflicts: # RtMidi.cpp # RtMidi.h # configure.ac
…ster-ts3 # Conflicts: # RtMidi.cpp
…ster-ts3 # Conflicts: # RtMidi.cpp # RtMidi.h
# Conflicts: # README.md # RtMidi.cpp # RtMidi.h # configure.ac # doc/doxygen/tutorial.txt
1st step towards better comparability to upstream
This matches the layout of upstream RtMidi.h.
…ster-ts3 # Conflicts: # Makefile.am # README.md # RtMidi.cpp # RtMidi.h # configure.ac # rtmidi_c.cpp # rtmidi_c.h
# Conflicts: # configure.ac
8f24b42
to
3f6ef4e
Compare
Fix capitalization of "CoreMIDI"
# Conflicts: # README.md # RtMidi.cpp # RtMidi.h # configure.ac
The current RtMidi implementation has a race condition that may be very annoying in certain cirumstances.
Steps to reproduce the problem:
The current patch set contains a suggestion for a reliable API.
The main problem that shall be addressed is that the current API does not store port descriptors together with the meta data (port names/port numbers). Thus, both can get out of sync.
The patches are based both on master and winks include:
• Winks patches as well as reverting them to avoid problems synchronizing with the master branch.
• some code reorganization (extract common API into a separate class)
• Add a port descriptor class (With a more flexible port naming interface).
• Add port descriptor API: getPortList, openPort(PortDescriptor &, const std::string&), getPortDescriptor()
• Add Example programs.
• Add an automatic test case for all backends that support virtual devices. This has been inspired by the automatic loopback test case of the node-midi project.
I came across the following questions:
• What's the purpose of class RtMidi? Is it used directly?
• RtMidiIn and RtMidiOut serve as API containers. Why do you use virtual inline functions, here? I'd suggest to remove the virtual classifier from the member functions and declare them only in RtMidi if they are used both by RtMidiIn and RtMidiOut. This would render CommonMidiApi useless and I would reintegrate it into MidiApi. Otherwise the inline functions should be marked extern to avoid linker errors.
• There is no function call ot set or get the current API object from RtMidi(In|Out). This and the fact that the implementation classes Midi(In|Out)(Alsa|Jack|WinMM|WinKS|Core|Dummy) are not documented separately suggest that these classes are private to the RtMidi library. Is that right? In this case I'd suggest to remove these classes from RtMidi.h. Otherwise I'd suggest to add two functions to set and get the API object that is used by the RtMidi(In|Out).
• Maybe… probably… I might add a container API that allows to collect several APIs into one common API.