mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 02:35:38 +08:00
Init context devices deferred as the settings are ONLY available after DBus is initialized
* we init in a context constructor * a this time it is not clear: ** if we will use a DBus scenario ** or standalone scenario
This commit is contained in:
@@ -139,16 +139,19 @@ namespace BlackCore
|
|||||||
this->initVoiceClient();
|
this->initVoiceClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
const CSettings as = m_audioSettings.getThreadLocal();
|
// here we are in a base class of one context
|
||||||
this->setVoiceOutputVolume(as.getOutVolume());
|
// the whole context/facade system is not initialized when this code here is executed
|
||||||
m_selcalPlayer = new CSelcalPlayer(CAudioDeviceInfo::getDefaultOutputDevice(), this);
|
|
||||||
|
|
||||||
this->changeDeviceSettings();
|
|
||||||
QPointer<CContextAudioBase> myself(this);
|
QPointer<CContextAudioBase> myself(this);
|
||||||
QTimer::singleShot(5000, this, [ = ]
|
QTimer::singleShot(5000, this, [ = ]
|
||||||
{
|
{
|
||||||
if (!myself || !sApp || sApp->isShuttingDown()) { return; }
|
if (!myself || !sApp || sApp->isShuttingDown()) { return; }
|
||||||
// myself->changeDeviceSettings();
|
|
||||||
|
const CSettings as = m_audioSettings.getThreadLocal();
|
||||||
|
this->setVoiceOutputVolume(as.getOutVolume());
|
||||||
|
m_selcalPlayer = new CSelcalPlayer(CAudioDeviceInfo::getDefaultOutputDevice(), this);
|
||||||
|
|
||||||
|
myself->changeDeviceSettings();
|
||||||
myself->onChangedAudioSettings();
|
myself->onChangedAudioSettings();
|
||||||
myself->onChangedLocalDevices(m_activeLocalDevices);
|
myself->onChangedLocalDevices(m_activeLocalDevices);
|
||||||
});
|
});
|
||||||
@@ -370,6 +373,7 @@ namespace BlackCore
|
|||||||
void CContextAudioBase::setCurrentAudioDevices(const CAudioDeviceInfo &inputDevice, const CAudioDeviceInfo &outputDevice)
|
void CContextAudioBase::setCurrentAudioDevices(const CAudioDeviceInfo &inputDevice, const CAudioDeviceInfo &outputDevice)
|
||||||
{
|
{
|
||||||
if (!m_voiceClient) { return; }
|
if (!m_voiceClient) { return; }
|
||||||
|
if (!sApp) { return; }
|
||||||
|
|
||||||
if (!inputDevice.getName().isEmpty() && inputDevice.getName() != m_inputDeviceSetting.get())
|
if (!inputDevice.getName().isEmpty() && inputDevice.getName() != m_inputDeviceSetting.get())
|
||||||
{
|
{
|
||||||
@@ -609,6 +613,12 @@ namespace BlackCore
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CContextAudioBase::isRunningWithLocalCore()
|
||||||
|
{
|
||||||
|
return sApp && sApp->isLocalContext();
|
||||||
|
}
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|
||||||
|
|||||||
@@ -339,6 +339,9 @@ namespace BlackCore
|
|||||||
int m_outVolumeBeforeMute = 90;
|
int m_outVolumeBeforeMute = 90;
|
||||||
static constexpr int MinUnmuteVolume = 20; //!< minimum volume when unmuted
|
static constexpr int MinUnmuteVolume = 20; //!< minimum volume when unmuted
|
||||||
|
|
||||||
|
//! Do we use a local core
|
||||||
|
static bool isRunningWithLocalCore();
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
BlackMisc::CSetting<BlackMisc::Audio::TSettings> m_audioSettings { this, &CContextAudioBase::onChangedAudioSettings };
|
BlackMisc::CSetting<BlackMisc::Audio::TSettings> m_audioSettings { this, &CContextAudioBase::onChangedAudioSettings };
|
||||||
BlackMisc::CSetting<BlackMisc::Audio::TVoiceSetup> m_voiceSettings { this, &CContextAudioBase::onChangedVoiceSettings };
|
BlackMisc::CSetting<BlackMisc::Audio::TVoiceSetup> m_voiceSettings { this, &CContextAudioBase::onChangedVoiceSettings };
|
||||||
|
|||||||
Reference in New Issue
Block a user