summaryrefslogtreecommitdiffstats
path: root/src/audio_core/sink/oboe_sink.h
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-12-17 06:11:20 +0100
committerLiam <byteslice@airmail.cc>2023-12-17 07:42:59 +0100
commit7239547eada6ad4a24e65957dfab180a51818947 (patch)
tree39b090bb0b9f74d8764a3c8d23ebd12c5e18f1f0 /src/audio_core/sink/oboe_sink.h
parentMerge pull request #12378 from liamwhite/offsetof (diff)
downloadyuzu-7239547eada6ad4a24e65957dfab180a51818947.tar
yuzu-7239547eada6ad4a24e65957dfab180a51818947.tar.gz
yuzu-7239547eada6ad4a24e65957dfab180a51818947.tar.bz2
yuzu-7239547eada6ad4a24e65957dfab180a51818947.tar.lz
yuzu-7239547eada6ad4a24e65957dfab180a51818947.tar.xz
yuzu-7239547eada6ad4a24e65957dfab180a51818947.tar.zst
yuzu-7239547eada6ad4a24e65957dfab180a51818947.zip
Diffstat (limited to 'src/audio_core/sink/oboe_sink.h')
-rw-r--r--src/audio_core/sink/oboe_sink.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/audio_core/sink/oboe_sink.h b/src/audio_core/sink/oboe_sink.h
new file mode 100644
index 000000000..8f6f54ab5
--- /dev/null
+++ b/src/audio_core/sink/oboe_sink.h
@@ -0,0 +1,75 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <list>
+#include <string>
+
+#include "audio_core/sink/sink.h"
+
+namespace Core {
+class System;
+}
+
+namespace AudioCore::Sink {
+class SinkStream;
+
+class OboeSink final : public Sink {
+public:
+ explicit OboeSink();
+ ~OboeSink() override;
+
+ /**
+ * Create a new sink stream.
+ *
+ * @param system - Core system.
+ * @param system_channels - Number of channels the audio system expects.
+ * May differ from the device's channel count.
+ * @param name - Name of this stream.
+ * @param type - Type of this stream, render/in/out.
+ *
+ * @return A pointer to the created SinkStream
+ */
+ SinkStream* AcquireSinkStream(Core::System& system, u32 system_channels,
+ const std::string& name, StreamType type) override;
+
+ /**
+ * Close a given stream.
+ *
+ * @param stream - The stream to close.
+ */
+ void CloseStream(SinkStream* stream) override;
+
+ /**
+ * Close all streams.
+ */
+ void CloseStreams() override;
+
+ /**
+ * Get the device volume. Set from calls to the IAudioDevice service.
+ *
+ * @return Volume of the device.
+ */
+ f32 GetDeviceVolume() const override;
+
+ /**
+ * Set the device volume. Set from calls to the IAudioDevice service.
+ *
+ * @param volume - New volume of the device.
+ */
+ void SetDeviceVolume(f32 volume) override;
+
+ /**
+ * Set the system volume. Comes from the audio system using this stream.
+ *
+ * @param volume - New volume of the system.
+ */
+ void SetSystemVolume(f32 volume) override;
+
+private:
+ /// List of streams managed by this sink
+ std::list<SinkStreamPtr> sink_streams{};
+};
+
+} // namespace AudioCore::Sink