aboutsummaryrefslogtreecommitdiff
path: root/core/qmpmidiplay.hpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2020-12-25 01:09:18 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2020-12-25 01:11:58 +0800
commit5e6e4615264214cf86cd74d63938c503fd36b74d (patch)
treecbda1f7c9376a140ce81ff2439f77ef75d353ddd /core/qmpmidiplay.hpp
parent14e01896cae2cbc7bf9aae37660e837f787ea20a (diff)
downloadQMidiPlayer-5e6e4615264214cf86cd74d63938c503fd36b74d.tar.xz
Proper event-based playback interruption.
Also fixed random pauses after seeking. This should address everything left over by 64fd118e.
Diffstat (limited to 'core/qmpmidiplay.hpp')
-rw-r--r--core/qmpmidiplay.hpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/qmpmidiplay.hpp b/core/qmpmidiplay.hpp
index b6a40d9..a4245ae 100644
--- a/core/qmpmidiplay.hpp
+++ b/core/qmpmidiplay.hpp
@@ -3,7 +3,9 @@
#define QMPMIDIPLAY_H
#include <cstring>
#include <cstdlib>
+#include <condition_variable>
#include <chrono>
+#include <mutex>
#include <unordered_map>
#include <tuple>
#include <utility>
@@ -70,6 +72,8 @@ private:
//raw tempo, timesig num., timesig den., division, keysig
//thread control
uint32_t tceptr, tcpaused, ct;
+ std::mutex intmtx;
+ std::condition_variable intcv;
bool tcstop;
uint32_t finished, resumed;
uint32_t pbr[16], pbv[16];
@@ -121,6 +125,7 @@ public:
void setTCeptr(uint32_t ep, uint32_t st);
uint32_t getTCpaused();
void setTCpaused(uint32_t ps);
+ void interrupt();
uint32_t isFinished();
bool stopFlag();
void setResumed();