aboutsummaryrefslogtreecommitdiff
path: root/src/aomusicplayer.h
diff options
context:
space:
mode:
authorSalanto <62221668+Salanto@users.noreply.github.com>2024-05-18 03:33:43 +0200
committerGitHub <noreply@github.com>2024-05-18 03:33:43 +0200
commit51338e30e046f1a62c84049b34577f0f3b5db6e3 (patch)
tree283c95f8f776ed852d03a816388695afd65c0f73 /src/aomusicplayer.h
parent469e293a1885e49f1d5994d41ac7cfc9f4666952 (diff)
parentf9c7205210fb9f768f583065971ece09e6b5eb03 (diff)
Merge pull request #957 from AttorneyOnline/kaleidoscope
The Kaleidoscope - Hell, it's about time.
Diffstat (limited to 'src/aomusicplayer.h')
-rw-r--r--src/aomusicplayer.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/aomusicplayer.h b/src/aomusicplayer.h
new file mode 100644
index 0000000..707d64a
--- /dev/null
+++ b/src/aomusicplayer.h
@@ -0,0 +1,38 @@
+#pragma once
+
+#include "aoapplication.h"
+
+#include <QFutureWatcher>
+
+class AOMusicPlayer
+{
+public:
+ // 0 = music
+ // 1 = ambience
+ static constexpr int STREAM_COUNT = 2;
+
+ explicit AOMusicPlayer(AOApplication *ao_app);
+ virtual ~AOMusicPlayer();
+
+ void setMuted(bool enabled);
+
+ QString playStream(QString song, int streamId, bool loopEnabled, int effectFlags);
+
+ void setStreamVolume(int value, int streamId);
+ void setStreamLooping(bool enabled, int streamId);
+
+ QFutureWatcher<QString> m_watcher;
+
+private:
+ AOApplication *ao_app;
+
+ bool m_muted = false;
+
+ int m_volume[STREAM_COUNT]{};
+ HSTREAM m_stream_list[STREAM_COUNT]{};
+ HSYNC m_loop_sync[STREAM_COUNT]{};
+ quint32 m_loop_start[STREAM_COUNT]{};
+ quint32 m_loop_end[STREAM_COUNT]{};
+
+ bool ensureValidStreamId(int streamId);
+};