I have a program using Qt and I need to make it play sounds using an output device that user selects in preferences. I can list all available devices that are in windows by calling this code:
QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
foreach (QAudioDeviceInfo i, devices)
this->ui->comboBox->addItem(i.deviceName());
However I have no idea how can I change the device that would be a default device for my application so that QMediaPlayer
would play all sounds using that device, instead of a default one. How can I do that? I am fine with windows only Qt5+ specific solution, although cross-platform solution would be probably best.
Basically I want to implement similar preferences dialog like this one from Microsoft Lync:
According to microsoft: https://social.technet.microsoft.com/Forums/windows/en-US/b1d1acac-1f21-4d23-8d68-98964d67c2c7/assigning-an-application-to-different-sound-outputs windows 7 introduced API's that can do that. However I have no idea how and where is that documented.