mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 11:05:44 +08:00
[AFV] restart function
This commit is contained in:
@@ -203,7 +203,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
// Method needs to be executed in the object thread since it will create new QObject children
|
// Method needs to be executed in the object thread since it will create new QObject children
|
||||||
QPointer<CAfvClient> myself(this);
|
QPointer<CAfvClient> myself(this);
|
||||||
QMetaObject::invokeMethod(this, [ = ]() { if (myself) disconnectFrom(stop); });
|
QMetaObject::invokeMethod(this, [ = ]() { if (myself) { disconnectFrom(stop); }});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,7 +260,8 @@ namespace BlackCore
|
|||||||
if (QThread::currentThread() != this->thread())
|
if (QThread::currentThread() != this->thread())
|
||||||
{
|
{
|
||||||
// Method needs to be executed in the object thread since it will create new QObject children
|
// Method needs to be executed in the object thread since it will create new QObject children
|
||||||
QMetaObject::invokeMethod(this, [ = ]() { startAudio(inputDevice, outputDevice); });
|
QPointer<CAfvClient> myself(this);
|
||||||
|
QMetaObject::invokeMethod(this, [ = ]() { if (myself) { startAudio(inputDevice, outputDevice); }});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,6 +365,23 @@ namespace BlackCore
|
|||||||
emit this->stoppedAudio();
|
emit this->stoppedAudio();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAfvClient::restartAudio()
|
||||||
|
{
|
||||||
|
if (!m_isStarted)
|
||||||
|
{
|
||||||
|
// just need to start
|
||||||
|
this->startAudio();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->stopAudio();
|
||||||
|
QPointer<CAfvClient> myself(this);
|
||||||
|
QTimer::singleShot(1000, this, [ = ]
|
||||||
|
{
|
||||||
|
if (myself) { myself->startAudio(); }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
double CAfvClient::getDeviceInputVolume() const
|
double CAfvClient::getDeviceInputVolume() const
|
||||||
{
|
{
|
||||||
if (m_input) { return m_input->getDeviceInputVolume(); }
|
if (m_input) { return m_input->getDeviceInputVolume(); }
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ namespace BlackCore
|
|||||||
void startAudio(const BlackMisc::Audio::CAudioDeviceInfo &inputDevice, const BlackMisc::Audio::CAudioDeviceInfo &outputDevice);
|
void startAudio(const BlackMisc::Audio::CAudioDeviceInfo &inputDevice, const BlackMisc::Audio::CAudioDeviceInfo &outputDevice);
|
||||||
Q_INVOKABLE void startAudio(const QString &inputDeviceName, const QString &outputDeviceName);
|
Q_INVOKABLE void startAudio(const QString &inputDeviceName, const QString &outputDeviceName);
|
||||||
void stopAudio();
|
void stopAudio();
|
||||||
|
void restartAudio();
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
//! The device's volume 0..1 @{
|
//! The device's volume 0..1 @{
|
||||||
|
|||||||
Reference in New Issue
Block a user