mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 11:05:44 +08:00
[AFV] CContextAudio::m_voiceClient is a raw pointer, and CAfvClient doesn't have a parent
This commit is contained in:
@@ -38,8 +38,8 @@ namespace BlackCore
|
|||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAfvClient::CAfvClient(const QString &apiServer, QObject *parent) :
|
CAfvClient::CAfvClient(const QString &apiServer, QObject *owner) :
|
||||||
CContinuousWorker(parent, "CAfvClient"),
|
CContinuousWorker(owner, "CAfvClient"),
|
||||||
m_connection(new CClientConnection(apiServer, this)),
|
m_connection(new CClientConnection(apiServer, this)),
|
||||||
m_input(new CInput(SampleRate, this)),
|
m_input(new CInput(SampleRate, this)),
|
||||||
m_output(new Output(this)),
|
m_output(new Output(this)),
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace BlackCore
|
|||||||
Q_ENUM(ConnectionStatus)
|
Q_ENUM(ConnectionStatus)
|
||||||
|
|
||||||
//! Ctor
|
//! Ctor
|
||||||
CAfvClient(const QString &apiServer, QObject *parent = nullptr);
|
CAfvClient(const QString &apiServer, QObject *owner);
|
||||||
|
|
||||||
//! Dtor
|
//! Dtor
|
||||||
virtual ~CAfvClient() override { this->stopAudio(); }
|
virtual ~CAfvClient() override { this->stopAudio(); }
|
||||||
|
|||||||
@@ -46,11 +46,11 @@ namespace BlackCore
|
|||||||
Q_ASSERT_X(m_voiceClient->owner() == this, Q_FUNC_INFO, "Wrong owner");
|
Q_ASSERT_X(m_voiceClient->owner() == this, Q_FUNC_INFO, "Wrong owner");
|
||||||
Q_ASSERT_X(!CThreadUtils::isApplicationThread(m_voiceClient->thread()), Q_FUNC_INFO, "Must NOT be in main thread");
|
Q_ASSERT_X(!CThreadUtils::isApplicationThread(m_voiceClient->thread()), Q_FUNC_INFO, "Must NOT be in main thread");
|
||||||
|
|
||||||
connect(m_voiceClient.get(), &CAfvClient::outputVolumePeakVU, this, &IContextAudio::outputVolumePeakVU);
|
connect(m_voiceClient, &CAfvClient::outputVolumePeakVU, this, &IContextAudio::outputVolumePeakVU);
|
||||||
connect(m_voiceClient.get(), &CAfvClient::inputVolumePeakVU, this, &IContextAudio::inputVolumePeakVU);
|
connect(m_voiceClient, &CAfvClient::inputVolumePeakVU, this, &IContextAudio::inputVolumePeakVU);
|
||||||
connect(m_voiceClient.get(), &CAfvClient::receivingCallsignsChanged, this, &IContextAudio::receivingCallsignsChanged);
|
connect(m_voiceClient, &CAfvClient::receivingCallsignsChanged, this, &IContextAudio::receivingCallsignsChanged);
|
||||||
connect(m_voiceClient.get(), &CAfvClient::updatedFromOwnAircraftCockpit, this, &IContextAudio::updatedFromOwnAircraftCockpit);
|
connect(m_voiceClient, &CAfvClient::updatedFromOwnAircraftCockpit, this, &IContextAudio::updatedFromOwnAircraftCockpit);
|
||||||
connect(m_voiceClient.data(), &CAfvClient::ptt, this, &IContextAudio::ptt);
|
connect(m_voiceClient, &CAfvClient::ptt, this, &IContextAudio::ptt);
|
||||||
|
|
||||||
const CSettings as = m_audioSettings.getThreadLocal();
|
const CSettings as = m_audioSettings.getThreadLocal();
|
||||||
this->setVoiceOutputVolume(as.getOutVolume());
|
this->setVoiceOutputVolume(as.getOutVolume());
|
||||||
@@ -107,7 +107,8 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
m_voiceClient->stopAudio();
|
m_voiceClient->stopAudio();
|
||||||
m_voiceClient->quitAndWait();
|
m_voiceClient->quitAndWait();
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(m_voiceClient.data()), Q_FUNC_INFO, "Needs to be back in current thread");
|
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(m_voiceClient), Q_FUNC_INFO, "Needs to be back in current thread");
|
||||||
|
m_voiceClient = nullptr;
|
||||||
}
|
}
|
||||||
QObject::disconnect(this);
|
QObject::disconnect(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ namespace BlackCore
|
|||||||
BlackMisc::CSetting<Audio::TOutputDevice> m_outputDeviceSetting { this, &IContextAudio::changeDeviceSettings };
|
BlackMisc::CSetting<Audio::TOutputDevice> m_outputDeviceSetting { this, &IContextAudio::changeDeviceSettings };
|
||||||
|
|
||||||
// AFV
|
// AFV
|
||||||
QScopedPointer<Afv::Clients::CAfvClient> m_voiceClient;
|
Afv::Clients::CAfvClient *m_voiceClient = nullptr;
|
||||||
|
|
||||||
// Players
|
// Players
|
||||||
BlackSound::CSelcalPlayer *m_selcalPlayer = nullptr;
|
BlackSound::CSelcalPlayer *m_selcalPlayer = nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user