Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Audio mixer: move master on the right, remember settings on project opening

parent fdc1d07a
Pipeline #8926 passed with stage
in 15 minutes and 56 seconds
......@@ -45,8 +45,10 @@ MixerManager::MixerManager(QWidget *parent)
, renderPosition(0)
, m_connectedWidgets(0)
{
m_masterBox = new QHBoxLayout;
m_box = new QHBoxLayout;
m_box->addStretch(10);
m_box->addLayout(m_masterBox);
setLayout(m_box);
m_timer.setSingleShot(true);
m_timer.setInterval(100);
......@@ -117,7 +119,12 @@ void MixerManager::resetAudioValues()
void MixerManager::cleanup()
{
for (auto item : m_mixers) {
m_box->removeWidget(item.second.get());
if (item.first > -1) {
m_box->removeWidget(item.second.get());
}
}
while (!m_masterBox->isEmpty()) {
m_masterBox->takeAt(0);
}
m_mixers.clear();
m_connectedWidgets = 0;
......@@ -142,7 +149,7 @@ void MixerManager::setModel(std::shared_ptr<TimelineItemModel> model)
Mlt::Tractor *service = model->tractor();
if (m_mixers.count(tid) > 0) {
// delete previous master mixer
m_box->removeWidget(m_mixers[tid].get());
m_masterBox->removeWidget(m_mixers[tid].get());
m_mixers.erase(tid);
}
std::shared_ptr<MixerWidget> mixer(new MixerWidget(tid, service, i18n("Master"), this));
......@@ -152,6 +159,6 @@ void MixerManager::setModel(std::shared_ptr<TimelineItemModel> model)
});
connect(this, &MixerManager::updateLevels, mixer.get(), &MixerWidget::updateAudioLevel);
m_mixers[tid] = mixer;
m_box->insertWidget(0, mixer.get());
m_masterBox->addWidget(mixer.get());
}
......@@ -67,6 +67,7 @@ private:
std::shared_ptr<Mlt::Tractor> m_masterService;
std::shared_ptr<TimelineItemModel> m_model;
QHBoxLayout *m_box;
QHBoxLayout *m_masterBox;
QTimer m_timer;
int m_lastFrame;
int m_connectedWidgets;
......
......@@ -129,7 +129,9 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackTag)
m_monitorFilter = fl;
} else if (filterService == QLatin1String("volume")) {
m_levelFilter = fl;
m_volumeSlider->setValue(m_levelFilter->get_int("level"));
int volume = m_levelFilter->get_int("level");
m_volumeSpin->setValue(volume);
m_volumeSlider->setValue(volume);
} else if (filterService == QLatin1String("panner")) {
m_balanceFilter = fl;
m_balanceSpin->setValue(m_balanceFilter->get_double("start") * 100 + 50);
......@@ -139,12 +141,14 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackTag)
if (m_levelFilter == nullptr) {
m_levelFilter.reset(new Mlt::Filter(service->get_profile(), "volume"));
if (m_levelFilter->is_valid()) {
m_levelFilter->set("internal_added", 237);
service->attach(*m_levelFilter.get());
}
}
if (m_balanceFilter == nullptr) {
m_balanceFilter.reset(new Mlt::Filter(service->get_profile(), "panner"));
if (m_balanceFilter->is_valid()) {
m_balanceFilter->set("internal_added", 237);
service->attach(*m_balanceFilter.get());
}
}
......@@ -196,6 +200,7 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackTag)
}
connect(m_volumeSlider, &QSlider::valueChanged, [&](int value) {
QSignalBlocker bk(m_volumeSpin);
m_volumeSpin->setValue(value);
if (m_levelFilter != nullptr) {
m_levelFilter->set("level", value);
......
......@@ -864,7 +864,13 @@ void EffectStackModel::importEffects(const std::weak_ptr<Mlt::Service> &service,
m_loadingExisting = alreadyExist;
if (auto ptr = service.lock()) {
for (int i = 0; i < ptr->filter_count(); i++) {
std::unique_ptr<Mlt::Service> filter(ptr->filter(i));
std::unique_ptr<Mlt::Filter> filter(ptr->filter(i));
if (filter->get_int("internal_added") > 0) {
if (auto ms = m_masterService.lock()) {
ms->attach(*filter.get());
}
continue;
}
if (filter->get("kdenlive_id") == nullptr) {
// don't consider internal MLT stuff
continue;
......
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