I’m trying to create an app that automatically detects the operating system’s default sound device so I can setup with the default device’s input & output.
I wonder if there can be a case that ofSoundStream::getDeviceList() doesn’t contain any default output on specific operating systems.
I mean there should be at least one default audio output unless the computer doesn’t have a sound device at all. am I correct?
it can be detected like this. please take a look at the code and my comment below.
int outputDeviceID = -1;
for (int i=0; i<soundStream.getDeviceList().size(); ++i) {
if (soundStream.getDeviceList()[i].isDefaultOutput) {
outputDeviceID = i;
break;
}
}
if (outputDeviceID < 0) {
cout << "Your computer doesn't have a sound device" << endl; // <-- is this always correct?
}