From eb9eb4d6e44409a810214ac3d8429213ff061d73 Mon Sep 17 00:00:00 2001 From: kkostiuk <kateryna.kostiuk@savoirfairelinux.com> Date: Wed, 26 May 2021 19:55:19 -0400 Subject: [PATCH] avmodel: link audio device event Change-Id: I1e6029c471ff89ad8b05653bc5c99da9a2d72cf9 --- src/api/avmodel.h | 6 +++++- src/avmodel.cpp | 16 +++++++++++++++- src/callbackshandler.cpp | 26 ++++++++++++++++++-------- src/callbackshandler.h | 14 ++++++++++++-- 4 files changed, 50 insertions(+), 12 deletions(-) diff --git a/src/api/avmodel.h b/src/api/avmodel.h index 6ee37aff..65cf1023 100644 --- a/src/api/avmodel.h +++ b/src/api/avmodel.h @@ -318,9 +318,13 @@ Q_SIGNALS: */ void frameUpdated(const QString& id); /** - * Emitted when a device is plugged or unplugged + * Emitted when a video device is plugged or unplugged */ void deviceEvent(); + /** + * Emitted when an audio device is plugged or unplugged + */ + void audioDeviceEvent(); /** * Audio volume level * @param id Ringbuffer id diff --git a/src/avmodel.cpp b/src/avmodel.cpp index eff1e74a..43cb55bd 100644 --- a/src/avmodel.cpp +++ b/src/avmodel.cpp @@ -114,9 +114,13 @@ public Q_SLOTS: */ void slotFrameUpdated(const QString& id); /** - * Detect when a device is plugged or unplugged + * Detect when a video device is plugged or unplugged */ void slotDeviceEvent(); + /** + * Detect when an audio device is plugged or unplugged + */ + void slotAudioDeviceEvent(); /** * Audio volume level * @param id Ringbuffer id @@ -643,6 +647,10 @@ AVModelPimpl::AVModelPimpl(AVModel& linked, const CallbacksHandler& callbacksHan SIZE_RENDERER = renderers_.size(); #endif connect(&callbacksHandler, &CallbacksHandler::deviceEvent, this, &AVModelPimpl::slotDeviceEvent); + connect(&callbacksHandler, + &CallbacksHandler::audioDeviceEvent, + this, + &AVModelPimpl::slotAudioDeviceEvent); connect(&callbacksHandler, &CallbacksHandler::audioMeter, this, &AVModelPimpl::slotAudioMeter); connect(&callbacksHandler, &CallbacksHandler::recordPlaybackStopped, @@ -859,6 +867,12 @@ AVModelPimpl::slotDeviceEvent() emit linked_.deviceEvent(); } +void +AVModelPimpl::slotAudioDeviceEvent() +{ + emit linked_.audioDeviceEvent(); +} + void AVModelPimpl::slotAudioMeter(const QString& id, float level) { diff --git a/src/callbackshandler.cpp b/src/callbackshandler.cpp index a3306fac..54777d5b 100644 --- a/src/callbackshandler.cpp +++ b/src/callbackshandler.cpp @@ -233,14 +233,17 @@ CallbacksHandler::CallbacksHandler(const Lrc& parent) this, &CallbacksHandler::slotDeviceEvent, Qt::QueuedConnection); + connect(&ConfigurationManager::instance(), + &ConfigurationManagerInterface::audioDeviceEvent, + this, + &CallbacksHandler::slotAudioDeviceEvent, + Qt::QueuedConnection); connect(&ConfigurationManager::instance(), &ConfigurationManagerInterface::audioMeter, this, &CallbacksHandler::slotAudioMeterReceived, Qt::QueuedConnection); - - } CallbacksHandler::~CallbacksHandler() {} @@ -249,11 +252,10 @@ void CallbacksHandler::subscribeToDebugReceived() { connect(&ConfigurationManager::instance(), - &ConfigurationManagerInterface::messageSend, - this, - &CallbacksHandler::slotDebugMessageReceived, - Qt::QueuedConnection); - + &ConfigurationManagerInterface::messageSend, + this, + &CallbacksHandler::slotDebugMessageReceived, + Qt::QueuedConnection); } void @@ -566,6 +568,12 @@ CallbacksHandler::slotDeviceEvent() emit deviceEvent(); } +void +CallbacksHandler::slotAudioDeviceEvent() +{ + emit audioDeviceEvent(); +} + void CallbacksHandler::slotAudioMeterReceived(const QString& id, float level) { @@ -573,7 +581,9 @@ CallbacksHandler::slotAudioMeterReceived(const QString& id, float level) } void -CallbacksHandler::slotRemoteRecordingChanged(const QString& callId, const QString& peerNumber, bool state) +CallbacksHandler::slotRemoteRecordingChanged(const QString& callId, + const QString& peerNumber, + bool state) { emit remoteRecordingChanged(callId, peerNumber, state); } diff --git a/src/callbackshandler.h b/src/callbackshandler.h index 1c8c478b..90de27d2 100644 --- a/src/callbackshandler.h +++ b/src/callbackshandler.h @@ -273,10 +273,15 @@ Q_SIGNALS: void stoppedDecoding(const QString& id, const QString& shmPath); /** - * Emitted when a device is plugged or unplugged + * Emitted when a video device is plugged or unplugged */ void deviceEvent(); + /** + * Emitted when an audio level is plugged or unplugged + */ + void audioDeviceEvent(); + /** * Emitted when an audio level is received * @param id of the ringbuffer level @@ -522,10 +527,15 @@ private Q_SLOTS: void slotStoppedDecoding(const QString& id, const QString& shmPath); /** - * Detect when a device is plugged or unplugged + * Detect when a video device is plugged or unplugged */ void slotDeviceEvent(); + /** + * Detect when an audio device is plugged or unplugged + */ + void slotAudioDeviceEvent(); + /** * Called when an audio meter level is received * @param id of the ringbuffer level -- GitLab