Audio mixer now clears cache so changes to volume/balance can be heard immediatly

parent 06f91f1d
......@@ -146,7 +146,6 @@ void MixerManager::setModel(std::shared_ptr<TimelineItemModel> model)
}
m_masterMixer.reset(new MixerWidget(-1, service, i18n("Master"), this));
connect(m_masterMixer.get(), &MixerWidget::muteTrack, [&](int /*id*/, bool mute) {
qDebug()<<"=== SETTING MUITE";
m_model->tractor()->set("hide", mute ? 3 : 1);
});
connect(this, &MixerManager::updateLevels, m_masterMixer.get(), &MixerWidget::updateAudioLevel);
......
......@@ -54,9 +54,8 @@ public slots:
signals:
void updateLevels(int);
void connectMixerRenderer(bool);
void triggerUpdate();
void recordAudio(int tid);
void purgeCache();
public:
int renderPosition;
......
......@@ -229,6 +229,7 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackTag)
m_solo = new QToolButton(this);
m_solo->setCheckable(true);
m_solo->setIcon(QIcon::fromTheme("headphones"));
m_solo->setToolTip(i18n("Solo mode"));
m_solo->setAutoRaise(true);
connect(m_solo, &QToolButton::toggled, [&](bool toggled) {
emit toggleSolo(m_tid, toggled);
......@@ -236,6 +237,7 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackTag)
});
m_record = new QToolButton(this);
m_record->setIcon(QIcon::fromTheme("media-record"));
m_record->setToolTip(i18n("Record"));
m_record->setCheckable(true);
m_record->setAutoRaise(true);
connect(m_record, &QToolButton::clicked, [&]() {
......@@ -252,6 +254,7 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackTag)
} else if (m_levelFilter != nullptr) {
m_levelFilter->set("level", value);
m_levelFilter->set("disable", value == 0 ? 1 : 0);
m_manager->purgeCache();
}
});
connect(m_balanceSpin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [&](int value) {
......@@ -260,6 +263,7 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackTag)
if (m_balanceFilter != nullptr) {
m_balanceFilter->set("start", (value + 50) / 100.);
m_balanceFilter->set("disable", value == 0 ? 1 : 0);
m_manager->purgeCache();
}
});
QVBoxLayout *lay = new QVBoxLayout;
......
......@@ -1886,6 +1886,7 @@ void MainWindow::connectDocument()
connect(pCore->monitorManager(), &MonitorManager::frameRendered, [&](int pos) {
pCore->mixer()->renderPosition = pos;
});
connect(pCore->mixer(), &MixerManager::purgeCache, m_projectMonitor, &Monitor::purgeCache);
// TODO REFAC: reconnect to new timeline
/*
......
......@@ -1421,6 +1421,15 @@ void GLWidget::mouseReleaseEvent(QMouseEvent *event)
setCursor(Qt::ArrowCursor);
}
void GLWidget::purgeCache()
{
if (m_consumer) {
m_consumer->purge();
m_producer->seek(m_proxy->position() + 1);
}
}
void GLWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
QQuickView::mouseDoubleClickEvent(event);
......
......@@ -141,6 +141,8 @@ public:
int duration() const;
/** @brief Set a property on the MLT consumer */
void setConsumerProperty(const QString &name, const QString &value);
/** @brief Clear consumer cache */
void purgeCache();
protected:
void mouseReleaseEvent(QMouseEvent *event) override;
......
......@@ -2131,3 +2131,8 @@ void Monitor::setConsumerProperty(const QString &name, const QString &value)
{
m_glMonitor->setConsumerProperty(name, value);
}
void Monitor::purgeCache()
{
m_glMonitor->purgeCache();
}
......@@ -318,6 +318,8 @@ public slots:
/** @brief Check current position to show relevant infos in qml view (markers, zone in/out, etc). */
void checkOverlay(int pos = -1);
void refreshMonitorIfActive(bool directUpdate = false) override;
/** @brief Clear read ahead cache, to ensure up to date audio */
void purgeCache();
signals:
void screenChanged(int screenIndex);
......
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