summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon/CubebStream.h
diff options
context:
space:
mode:
authorMichael Maltese <michaeljosephmaltese@gmail.com>2017-03-22 16:09:59 -0700
committerMichael Maltese <michaeljosephmaltese@gmail.com>2017-05-27 18:28:56 -0700
commitf6e1da0dc00dc3437dfc8dd4a963e648fd6584a1 (patch)
tree6e3fbaf3712368d96873f32376e05e401931b50b /Source/Core/AudioCommon/CubebStream.h
parent17f4413143af44927b702267ae7d35af2eb357ec (diff)
AudioCommon: add Cubeb backend
Diffstat (limited to 'Source/Core/AudioCommon/CubebStream.h')
-rw-r--r--Source/Core/AudioCommon/CubebStream.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/Source/Core/AudioCommon/CubebStream.h b/Source/Core/AudioCommon/CubebStream.h
new file mode 100644
index 0000000000..32434affd1
--- /dev/null
+++ b/Source/Core/AudioCommon/CubebStream.h
@@ -0,0 +1,32 @@
+// Copyright 2017 Dolphin Emulator Project
+// Licensed under GPLv2+
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <cstddef>
+#include <memory>
+
+#include "AudioCommon/SoundStream.h"
+
+#include <cubeb/cubeb.h>
+
+class CubebStream final : public SoundStream
+{
+public:
+ bool Start() override;
+ void Stop() override;
+ void SetVolume(int) override;
+
+private:
+ bool m_stereo = false;
+ cubeb* m_ctx = nullptr;
+ cubeb_stream* m_stream = nullptr;
+
+ std::vector<short> m_short_buffer;
+ std::vector<float> m_floatstereo_buffer;
+
+ static long DataCallback(cubeb_stream* stream, void* user_data, const void* /*input_buffer*/,
+ void* output_buffer, long num_frames);
+ static void StateCallback(cubeb_stream* stream, void* user_data, cubeb_state state);
+};