Im having problems switching the audio input device on OSX too. Its probably something really silly, but i don’t see it (i only program for about 3 years now and haven’t yet learned everything about c++/ cinder yet).
So first of all some code:
// from the class declaration:
void LoopStationApp::setInputDevice( const audio::DeviceRef &device, int numChannels)
inDev = nullptr;
auto format = audio::Node::Format();
format.channels( numChannels );
inDev = audio::master()->createInputDeviceNode( device, format );
inDev >> inGain; // Trying to reconnect, here is where i get an exception. Also tried inDev->connect(inGain), what should mean the same, i think
The Error i am getting is a Bad Access Exception, thrown by the AudioObjectRemovePropertyListenerBlock (a Core Audio Function). I checked, that inGain is still there, it is not connected to any input anymore. I also compared my code to the code of the DeviceTestApp, but the code of the app is not working in my environment (i don’t know why, but i had the same problem with switching the outputDevice - that is working right now; although: The DeviceApp is running correctly). I also checked that i pass a device and that the reference is not empty.
Also strange is that when i setup everything, it all works fine. I can record anything - but when i try to change the device it does not work.
And one last thing: I don’t think the uninitilialize() method is called. But i did not find out how to make sure that happens too.
If there is anybody who has an idea what might be wrong or where to look, i would be really grateful! I am working on this problem for really a long time now.