-
Notifications
You must be signed in to change notification settings - Fork 300
Open
Description
Looking at #228, the idea is that it is problematic not to be able to provide an error handler before the API was initialized, making it impossible to catch and display warnings in some other context.
Two ideas to handle this:
- Provide a static default
RtMidi::setDefaultErrorHandlerwhich can be called early in the program and will be used if no RtMidi object has a specific handler set. This is implemented here: radarsat1@c5bff5e - The other way I thought of is to specify such a callback as an argument to RtMidiIn and RtMidiOut constructors, so that they are available at the earliest moment. This is implemented here: radarsat1@5d7a494
To be honest I am not sure which is best, they both seem to have some advantages. For (2), the default value for the parameter is nullptr, so it is not required to give anything here and RtMidi will work just as before. Similar for (1), if setDefaultErrorHandler is not called. So neither changes the API.
I think it comes down to preference, so asking for opinions. Constructor arguments or static function?
Metadata
Metadata
Assignees
Labels
No labels