summaryrefslogtreecommitdiff
path: root/Servers/AudioServer/ASMixer.h
diff options
context:
space:
mode:
Diffstat (limited to 'Servers/AudioServer/ASMixer.h')
-rw-r--r--Servers/AudioServer/ASMixer.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/Servers/AudioServer/ASMixer.h b/Servers/AudioServer/ASMixer.h
new file mode 100644
index 0000000000..2cf45fd13f
--- /dev/null
+++ b/Servers/AudioServer/ASMixer.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <AK/RefCounted.h>
+#include <AK/ByteBuffer.h>
+#include <LibCore/CFile.h>
+#include <LibCore/CLock.h>
+#include <LibAudio/ABuffer.h>
+#include <AK/NonnullRefPtrVector.h>
+
+class ASClientConnection;
+
+class ASMixer : public RefCounted<ASMixer> {
+public:
+ ASMixer();
+
+ void queue(ASClientConnection&, const ABuffer&);
+
+private:
+ struct ASMixerBuffer {
+ ASMixerBuffer(const NonnullRefPtr<ABuffer>& buf)
+ : buffer(buf)
+ {}
+ NonnullRefPtr<ABuffer> buffer;
+ int pos { 0 };
+ bool done { false };
+ };
+
+ Vector<ASMixerBuffer> m_pending_mixing;
+ CFile m_device;
+ CLock m_lock;
+
+ void mix();
+};