mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 23:45:35 +08:00
Add audio device settings
Summary: Up to now, the audio device settings were not persistent. With this commit, the last audio device will be restored after application start. Reviewers: kbasan, msutcliffe Reviewed By: msutcliffe Differential Revision: https://dev.swift-project.org/D7
This commit is contained in:
committed by
Mathew Sutcliffe
parent
f0bfad40b7
commit
862794cb02
@@ -88,6 +88,8 @@ namespace BlackCore
|
||||
m_unusedVoiceChannels.push_back(m_channel2);
|
||||
|
||||
m_selcalPlayer = new CSelcalPlayer(QAudioDeviceInfo::defaultOutputDevice(), this);
|
||||
|
||||
changeDeviceSettings();
|
||||
}
|
||||
|
||||
CContextAudio *CContextAudio::registerWithDBus(CDBusServer *server)
|
||||
@@ -207,6 +209,10 @@ namespace BlackCore
|
||||
this->m_voiceInputDevice->setInputDevice(audioDevice);
|
||||
changed = true;
|
||||
}
|
||||
if (m_inputDeviceSetting.get() != audioDevice.getName())
|
||||
{
|
||||
m_inputDeviceSetting.set(audioDevice.getName());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -215,6 +221,10 @@ namespace BlackCore
|
||||
this->m_voiceOutputDevice->setOutputDevice(audioDevice);
|
||||
changed = true;
|
||||
}
|
||||
if (m_outputDeviceSetting.get() != audioDevice.getName())
|
||||
{
|
||||
m_outputDeviceSetting.set(audioDevice.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
@@ -549,6 +559,35 @@ namespace BlackCore
|
||||
emit this->changedVoiceRoomMembers();
|
||||
}
|
||||
|
||||
void CContextAudio::changeDeviceSettings()
|
||||
{
|
||||
QString inputDeviceName = m_inputDeviceSetting.get();
|
||||
if (!inputDeviceName.isEmpty())
|
||||
{
|
||||
for (auto device : m_voiceInputDevice->getInputDevices())
|
||||
{
|
||||
if (device.getName() == inputDeviceName)
|
||||
{
|
||||
setCurrentAudioDevice(device);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString outputDeviceName = m_outputDeviceSetting.get();
|
||||
if (!outputDeviceName.isEmpty())
|
||||
{
|
||||
for (auto device : m_voiceOutputDevice->getOutputDevices())
|
||||
{
|
||||
if (device.getName() == outputDeviceName)
|
||||
{
|
||||
setCurrentAudioDevice(device);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QSharedPointer<IVoiceChannel> CContextAudio::getVoiceChannelBy(const CVoiceRoom &voiceRoom)
|
||||
{
|
||||
QSharedPointer<IVoiceChannel> voiceChannel;
|
||||
|
||||
Reference in New Issue
Block a user