summaryrefslogtreecommitdiff
path: root/dgedit/player.h
diff options
context:
space:
mode:
Diffstat (limited to 'dgedit/player.h')
-rw-r--r--dgedit/player.h27
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__*/