From 68e4647e565519c57d76b95806dd9431a4ecfbb1 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 18 Apr 2014 13:16:03 +0200 Subject: New player model (again). --- dgedit/player.h | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'dgedit/player.h') diff --git a/dgedit/player.h b/dgedit/player.h index 2977103..60b2ccb 100644 --- a/dgedit/player.h +++ b/dgedit/player.h @@ -29,10 +29,11 @@ #include #include +#include #include -#include "canvas.h" +#include "selection.h" class Player : public QThread { Q_OBJECT @@ -45,8 +46,9 @@ public: // TODO: Make these private. // These two need to be public in order for the ugly hack in // CanvasToolListen::playRange to work... - volatile bool playing; + // volatile bool playing; volatile size_t pos; + volatile size_t end; public slots: /** @@ -72,6 +74,22 @@ public slots: */ void setPosition(size_t position); + /** + * Play range based on selection including fade-in/out. + * @param length Stop playing after length samples. -1 means play all. + */ + void playSelection(Selection selection, int length = -1); + + /** + * Return true if last selection is done playing. + */ + bool playSelectionDone(); + + /** + * Stop playing + */ + void stop(); + signals: /** * The absolute maximum of samples seen since last update. @@ -103,6 +121,11 @@ private: double peak; bool running; + + QMutex mutex; + volatile bool new_selection; + size_t sel_end; + Selection selection; }; #endif/*__DRUMGIZMO_PLAYER_H__*/ -- cgit v1.2.3