From 7830db71fa0160d7f40ea9b4650003019c2ff50c Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sun, 14 Jan 2024 00:57:23 -0500 Subject: Fixes for channels window and simple visualization. a) Channel status light doesn't blink in release builds. b) Simple visualization shows blank channel info when opened. --- core/qmpmidiplay.cpp | 6 ++++-- qmidiplayer-desktop/qmpchannelswindow.cpp | 3 ++- qmidiplayer-desktop/qmpmainwindow.cpp | 2 +- qmidiplayer-desktop/qmpplugin.cpp | 2 +- simple-visualization/simplevisualization.cpp | 3 +++ 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/core/qmpmidiplay.cpp b/core/qmpmidiplay.cpp index 113045f..431c16a 100644 --- a/core/qmpmidiplay.cpp +++ b/core/qmpmidiplay.cpp @@ -20,8 +20,10 @@ bool CMidiPlayer::processEvent(const SEvent *e) if (eventHandlerCB[i]) eventHandlerCB[i]->callBack((void *)&fe, eventHandlerCBuserdata[i]); for (auto i = event_handlers.begin(); i != event_handlers.end(); ++i) - if (!std::get<2>(i->second)) - std::get<0>(i->second)((void *)e, std::get<1>(i->second)); + { + auto [f, d, p] = i->second; + if (!p) f((void *)e, d); + } uint8_t ch = e->type & 0x0F; if ((e->type & 0xF0) < 0xF0) levtt[ch] = std::chrono::system_clock::now(); diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp index 7743084..a97d86b 100644 --- a/qmidiplayer-desktop/qmpchannelswindow.cpp +++ b/qmidiplayer-desktop/qmpchannelswindow.cpp @@ -8,7 +8,8 @@ #include "ui_qmpchannelswindow.h" #include "qmpmainwindow.hpp" -qmpChannelsModel::qmpChannelsModel(QObject *parent): QAbstractTableModel(parent) +qmpChannelsModel::qmpChannelsModel(QObject *parent): QAbstractTableModel(parent), + updatequeued(false) { evh = qmpMainWindow::getInstance()->getPlayer()->registerEventHandler( [this](const void *_e, void *) diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp index 9b18e0d..cc315df 100644 --- a/qmidiplayer-desktop/qmpmainwindow.cpp +++ b/qmidiplayer-desktop/qmpmainwindow.cpp @@ -601,7 +601,7 @@ void qmpMainWindow::on_pbPlayPause_clicked() offset = 0; timer->start(UPDATE_INTERVAL); stopped = false; - ui->pbPlayPause->setIcon(QIcon(getThemedIcon(":/img/play.svg"))); + ui->pbPlayPause->setIcon(QIcon(getThemedIcon(":/img/pause.svg"))); } else setPaused(playing); diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp index 7efd345..eb374d6 100644 --- a/qmidiplayer-desktop/qmpplugin.cpp +++ b/qmidiplayer-desktop/qmpplugin.cpp @@ -180,7 +180,7 @@ double qmpPluginAPIImpl::getRealTempo() } uint32_t qmpPluginAPIImpl::getTimeSig() { - int n, d = 0, t; + int n, d = 0, t = 1; qmw &&qmw->getPlayer() ? qmw->getPlayer()->getCurrentTimeSignature(&n, &t) : void(0); for (; t >>= 1; ++d); return n << 8 | d; diff --git a/simple-visualization/simplevisualization.cpp b/simple-visualization/simplevisualization.cpp index 0c3a5b9..514d8af 100644 --- a/simple-visualization/simplevisualization.cpp +++ b/simple-visualization/simplevisualization.cpp @@ -8,6 +8,7 @@ qmpSimpleVisualization::qmpSimpleVisualization(qmpPluginAPI *_api) void qmpSimpleVisualization::show() { p->show(); + p->resetAll(); } void qmpSimpleVisualization::close() { @@ -28,6 +29,8 @@ void qmpSimpleVisualization::init() }; uihs = api->registerUIHook("main.stop", refreshfn, nullptr); uihsk = api->registerUIHook("main.seek", refreshfn, nullptr); + uihsk = api->registerUIHook("main.start", refreshfn, nullptr); + uihsk = api->registerUIHook("main.reset", refreshfn, nullptr); uihsk = api->registerUIHook("preset.set", refreshfn, nullptr); uihsk = api->registerUIHook("channel.ccchange", refreshfn, nullptr); } -- cgit v1.2.3