there can be more midi drivers simultaneously pointing to the same device
Closed this issue · 0 comments
Raffaello commented
even though only 1 will play with the shared device.
But it can be more useful to just avoid creating another driver with the same shared devices as it can just be pointless.
for e.g. it could "throw" in the constructor ? or avoid throwing and create an init method?
but at the moment how is structured the code:
snippet e.g:
drivers::MIDDriver midDrv1(mixer, opl_midi);
drivers::MIDDriver midDrv2(mixer, opl_midi); // <- this should be pointless
how to prevent creating a 2nd midDrv2
in this case?
The only way would be having some MidDrvManager
that is returning the midDrv given the 2 parameters.
So must store the reference/pointers of those parameters as key pair and the value is the resulting created driver.
basically a Map<pair,*MIDDriver> kinda.
Is it useful? well maybe,
for now i don't see the point yet.