Commit 6e90d733 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Update audio recording. Now triggered by the play button when in monitor mode.

parent 6658a97d
Pipeline #184690 passed with stage
in 6 minutes and 20 seconds
......@@ -93,7 +93,6 @@ MixerWidget::MixerWidget(int tid, std::shared_ptr<Mlt::Tractor> service, QString
, m_maxLevels(qMax(30, int(service->get_fps() * 1.5)))
, m_solo(nullptr)
, m_collapse(nullptr)
, m_record(nullptr)
, m_monitor(nullptr)
, m_lastVolume(0)
, m_listener(nullptr)
......@@ -115,7 +114,6 @@ MixerWidget::MixerWidget(int tid, Mlt::Tractor *service, QString trackTag, const
, m_maxLevels(qMax(30, int(service->get_fps() * 1.5)))
, m_solo(nullptr)
, m_collapse(nullptr)
, m_record(nullptr)
, m_monitor(nullptr)
, m_lastVolume(0)
, m_listener(nullptr)
......@@ -290,14 +288,6 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackName)
updateLabel();
});
m_record = new QToolButton(this);
m_record->setIcon(QIcon::fromTheme("media-record"));
m_record->setToolTip(i18n("Record audio"));
m_record->setCheckable(true);
m_record->setAutoRaise(true);
m_record->setVisible(false);
connect(m_record, &QToolButton::toggled, this, [&](bool toggled) { emit pCore->recordAudio(m_tid, toggled); });
m_monitor = new QToolButton(this);
m_monitor->setIcon(QIcon::fromTheme("audio-input-microphone"));
m_monitor->setToolTip(i18n("Monitor audio input"));
......@@ -379,9 +369,6 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackName)
if (m_solo) {
buttonslay->addWidget(m_solo);
}
if (m_record) {
buttonslay->addWidget(m_record);
}
if (m_monitor) {
buttonslay->addWidget(m_monitor);
}
......@@ -557,13 +544,9 @@ void MixerWidget::monitorAudio(bool monitor)
qDebug() << ":::: MONIOTORING AUDIO: " << monitor;
if (monitor) {
m_monitor->setChecked(true);
m_solo->setVisible(false);
m_record->setVisible(true);
updateMonitorState();
} else {
m_monitor->setChecked(false);
m_solo->setVisible(true);
m_record->setVisible(false);
updateMonitorState();
reset();
}
......
......@@ -90,7 +90,6 @@ private:
QSlider *m_volumeSlider;
QToolButton *m_solo;
QToolButton *m_collapse;
QToolButton *m_record;
QToolButton *m_monitor;
KSqueezedTextLabel *m_trackLabel;
QMutex m_storeMutex;
......
......@@ -1013,6 +1013,7 @@ void Core::stopMediaCapture(int tid, bool checkAudio, bool checkVideo)
void Core::monitorAudio(int tid, bool monitor)
{
m_mainWindow->getCurrentTimeline()->controller()->switchTrackRecord(tid, monitor);
m_monitorManager->projectMonitor()->switchRecordButton(monitor);
}
void Core::startRecording()
......
......@@ -2696,3 +2696,11 @@ void Monitor::stopCountDown()
QMetaObject::invokeMethod(root, "stopCountdown");
}
}
void Monitor::switchRecordButton(bool record)
{
if (record && isPlaying()) {
stop();
}
m_playAction->setInactiveIcon(QIcon::fromTheme(record ? QStringLiteral("media-record") : QStringLiteral("media-playback-start")));
}
......@@ -146,6 +146,8 @@ public:
/** @brief Show a rec countdown over the monitor **/
void startCountDown();
void stopCountDown();
/** @brief When we are in audio monitoring mode, play button turns to rec **/
void switchRecordButton(bool record);
protected:
void mousePressEvent(QMouseEvent *event) override;
......
......@@ -60,7 +60,7 @@ Item {
parent.border.width = 1
}
onClicked: {
timeline.switchRecording(trackId)
timeline.switchRecording(trackId, recState == 1 ? 0 : 1)
}
}
}
......
......@@ -57,7 +57,7 @@ Rectangle {
function startAudioRecord(tid) {
var tk = Logic.getTrackById(tid)
recordPlaceHolder.y = tk.y
recordPlaceHolder.y = tk.y + subtitleTrack.height
recordPlaceHolder.height = tk.height
recordStartPlaceHolder.x = root.consumerPosition * root.timeScale
recordPlaceHolder.anchors.right = cursor.left
......
Supports Markdown
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