Update record volume when changed from mixer

parent 11bc0f08
......@@ -66,6 +66,7 @@ signals:
void recordAudio(int tid);
void purgeCache();
void clearMixers();
void updateRecVolume();
protected:
std::unordered_map<int, std::shared_ptr<MixerWidget>> m_mixers;
......
......@@ -294,6 +294,7 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackTag)
if (m_recording) {
m_volumeSpin->setValue(value);
KdenliveSettings::setAudiocapturevolume(value);
m_manager->updateRecVolume();
//TODO update capture volume
} else if (m_levelFilter != nullptr) {
double dbValue = 0;
......
......@@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mediacapture.h"
#include "audiomixer/mixermanager.hpp"
#include "kdenlivesettings.h"
#include "core.h"
#include <QAudioProbe>
......@@ -32,7 +33,6 @@ MediaCapture::MediaCapture(QObject *parent)
: QObject(parent)
, currentState(-1)
, m_audioDevice("default:")
, m_volume(1.)
, m_path(QUrl())
, m_recordState(0)
{
......@@ -41,6 +41,7 @@ MediaCapture::MediaCapture(QObject *parent)
m_resetTimer.setInterval(5000);
m_resetTimer.setSingleShot(true);
connect(&m_resetTimer, &QTimer::timeout, this, &MediaCapture::resetIfUnused);
connect(pCore->mixer(), &MixerManager::updateRecVolume, this, &MediaCapture::setAudioVolume);
}
MediaCapture::~MediaCapture() = default;
......@@ -82,8 +83,7 @@ void MediaCapture::recordAudio(int tid, bool record)
setAudioCaptureDevice();
m_audioRecorder->setAudioInput(m_audioDevice);
setCaptureOutputLocation();
setAudioVolume();
m_audioRecorder->setVolume(m_volume);
m_audioRecorder->setVolume(KdenliveSettings::audiocapturevolume()/100.0);
//qDebug()<<"START AREC: "<<m_path<<"\n; CODECS: "<<m_audioRecorder->supportedAudioCodecs();
connect(m_audioRecorder.get(), SIGNAL(error(QMediaRecorder::Error)), this, SLOT(displayErrorMessage()));
......@@ -183,7 +183,9 @@ void MediaCapture::setAudioCaptureDevice()
void MediaCapture::setAudioVolume()
{
m_volume = KdenliveSettings::audiocapturevolume()/100.0;
if (m_audioRecorder) {
m_audioRecorder->setVolume(KdenliveSettings::audiocapturevolume()/100.0);
}
}
int MediaCapture::getState()
......
......@@ -54,8 +54,6 @@ public:
QUrl getCaptureOutputLocation();
/** @brief Sets m_audioDevice to selected audio capture device **/
void setAudioCaptureDevice();
/** @brief Sets m_volume to selected audio capture volume **/
void setAudioVolume();
/** @brief Returns list of audio devices available for capture **/
QStringList getAudioCaptureDevices();
/** @brief Sets currentState to QMediaRecorder::State value and returns it **/
......@@ -66,6 +64,8 @@ public:
public slots:
void displayErrorMessage();
/** @brief Sets m_volume to selected audio capture volume **/
void setAudioVolume();
private:
std::unique_ptr<QAudioRecorder> m_audioRecorder;
......@@ -73,7 +73,6 @@ private:
std::unique_ptr<QCamera> m_camera;
std::unique_ptr<QAudioProbe> m_probe;
QString m_audioDevice;
qreal m_volume;
QUrl m_path;
QVector<qreal> m_levels;
int m_recordState;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment