-
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 #21
Conversation
…ncompilable. The code still exists in the winks branch.
This reverts commit 774c664.
…me." This reverts commit 745fbe3.
This reverts commit 290db6c.
…te and uncompilable. The code still exists in the winks branch." This reverts commit d07f601.
This helps certain editors to select the correct mode that usually interpet .h files as C headers.
This includes also some reorganisation that moves the common global/local API out of RtMIDI and the backend api.
…Api. The new MidiApi is now called CommonMidiApi. This avoids some compilation errors.
This should be better readable.
…i(In|Out). This patch includes more than it was intended to. The changes include: • provide a namespace rtmidi to simplify class names • Make all functions of Midi(In|Out)? non-virtual. Virtual inline functions have several pitfalls. • provide Dummies for the new ALSA api. • provide workaround for the major API breaks. • use references for passing certain pointer arguments and deprecate the pointer versions of these functions.
Even though this feature is currently unused we should use a different library version for future development. While we provide workarounds for the API the ABI has changed.
…c ALSA calls. This layer provides an API that is more consistent with the data used by RtMidi. On the other hand it allows to optionally use a locking mechanism for all sequencer calls so that ALSA may use one client for all threads for certain tasks (or if it is requested).
The ALSA output devices should be still considered broken.
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>
I have a few questions / comments:
Finally, I’d like to look through the code you’ve created though not necessarily via the winks branch. To go back to the motivation for your code changes, my expectation all along has been that the client should always re-poll RtMidi for the available devices any time a user might be allowed to make a new port connection (for exactly the reason you gave as an example … someone might have disconnected something). That is, client programs should not “store” a set of available devices and then continue to use that set without always checking to verify it is still valid. But no matter, the existing port identification scheme is still weak and could use a more robust implementation. Thus, I’m happy you have taken the time to work out a possible solution. Regards, —gary On May 3, 2014, at 5:47 AM, keinstein notifications@github.com wrote:
|
Hi Gary, Am 07.05.2014 18:23, schrieb garyscavone:
Regards, Tobias
|
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.