aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2023-11-09 20:17:16 -0500
committerGravatar Chris Xiong <chirs241097@gmail.com> 2023-11-09 20:17:16 -0500
commit095716fa21071a506605304db6a113f231ff0dcd (patch)
treed09a10998926ac4f51958e9f3847a2ef39de320c /core
parent07ee50be7c390668f8c600b8eb5805f56cf6a8a1 (diff)
downloadQMidiPlayer-095716fa21071a506605304db6a113f231ff0dcd.tar.xz
Fix lingering notes with newer fluidsynth versions.
Diffstat (limited to 'core')
-rw-r--r--core/qmpmidiplay.cpp19
-rw-r--r--core/qmpmidiplay.hpp3
2 files changed, 14 insertions, 8 deletions
diff --git a/core/qmpmidiplay.cpp b/core/qmpmidiplay.cpp
index c3c52ca..113045f 100644
--- a/core/qmpmidiplay.cpp
+++ b/core/qmpmidiplay.cpp
@@ -189,7 +189,7 @@ SEvent *CMidiPlayer::getEvent(uint32_t id)
}
void CMidiPlayer::prePlayInit()
{
- playerPanic(true);
+ playerReset();
for (size_t i = 0; i < mididev.size(); ++i)
if (mididev[i].refcnt)
mididev[i].dev->reset(0xFF);
@@ -382,16 +382,21 @@ CMidiPlayer::~CMidiPlayer()
delete midiFile;
delete midiReaders;
}
-void CMidiPlayer::playerPanic(bool reset)
+void CMidiPlayer::playerReset()
{
for (auto &i : mididev)
if (i.refcnt)
{
- if (reset)
- i.dev->reset(0xff);
- else
- for (uint8_t j = 0; j < 16; ++j)
- i.dev->panic(j);
+ i.dev->reset(0xff);
+ }
+}
+void CMidiPlayer::playerPanic()
+{
+ for (auto &i : mididev)
+ if (i.refcnt)
+ {
+ for (uint8_t j = 0; j < 16; ++j)
+ i.dev->panic(j);
}
}
bool CMidiPlayer::playerLoadFile(const char *fn)
diff --git a/core/qmpmidiplay.hpp b/core/qmpmidiplay.hpp
index 56a26fd..03495b9 100644
--- a/core/qmpmidiplay.hpp
+++ b/core/qmpmidiplay.hpp
@@ -117,7 +117,8 @@ public:
void playerInit();
void playerDeinit();
void playerThread();
- void playerPanic(bool reset = false);
+ void playerReset();
+ void playerPanic();
//playing control methods
uint32_t getStamp(int id);