diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-04-18 13:16:03 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-04-18 13:16:03 +0200 |
commit | 68e4647e565519c57d76b95806dd9431a4ecfbb1 (patch) | |
tree | e7868dfa39dc886d21967dd6766072067d37636c /dgedit/player.h | |
parent | 11b8e6db937f4c77942febb69f7b41e87ae0b6e0 (diff) |
New player model (again).
Diffstat (limited to 'dgedit/player.h')
-rw-r--r-- | dgedit/player.h | 27 |
1 files changed, 25 insertions, 2 deletions
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 <QThread> #include <QTimer> +#include <QMutex> #include <ao/ao.h> -#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__*/ |