summaryrefslogtreecommitdiffstats
path: root/src/audio_core/sink/null_sink.h
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2022-07-23 21:20:39 +0200
committerGitHub <noreply@github.com>2022-07-23 21:20:39 +0200
commit97729fd8e9c2f8cabc626ab03a666c9428e01c5e (patch)
treef6a2f3b6c71b51a646d1502c01a4f6be92a3ed26 /src/audio_core/sink/null_sink.h
parentMerge pull request #8629 from Docteh/test_transifex (diff)
parentProject Andio (diff)
downloadyuzu-97729fd8e9c2f8cabc626ab03a666c9428e01c5e.tar
yuzu-97729fd8e9c2f8cabc626ab03a666c9428e01c5e.tar.gz
yuzu-97729fd8e9c2f8cabc626ab03a666c9428e01c5e.tar.bz2
yuzu-97729fd8e9c2f8cabc626ab03a666c9428e01c5e.tar.lz
yuzu-97729fd8e9c2f8cabc626ab03a666c9428e01c5e.tar.xz
yuzu-97729fd8e9c2f8cabc626ab03a666c9428e01c5e.tar.zst
yuzu-97729fd8e9c2f8cabc626ab03a666c9428e01c5e.zip
Diffstat (limited to 'src/audio_core/sink/null_sink.h')
-rw-r--r--src/audio_core/sink/null_sink.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/audio_core/sink/null_sink.h b/src/audio_core/sink/null_sink.h
new file mode 100644
index 000000000..47a342171
--- /dev/null
+++ b/src/audio_core/sink/null_sink.h
@@ -0,0 +1,52 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "audio_core/sink/sink.h"
+#include "audio_core/sink/sink_stream.h"
+
+namespace AudioCore::Sink {
+/**
+ * A no-op sink for when no audio out is wanted.
+ */
+class NullSink final : public Sink {
+public:
+ explicit NullSink(std::string_view) {}
+ ~NullSink() override = default;
+
+ SinkStream* AcquireSinkStream([[maybe_unused]] Core::System& system,
+ [[maybe_unused]] u32 system_channels,
+ [[maybe_unused]] const std::string& name,
+ [[maybe_unused]] StreamType type) override {
+ return &null_sink_stream;
+ }
+
+ void CloseStream([[maybe_unused]] const SinkStream* stream) override {}
+ void CloseStreams() override {}
+ void PauseStreams() override {}
+ void UnpauseStreams() override {}
+ f32 GetDeviceVolume() const override {
+ return 1.0f;
+ }
+ void SetDeviceVolume(f32 volume) override {}
+ void SetSystemVolume(f32 volume) override {}
+
+private:
+ struct NullSinkStreamImpl final : SinkStream {
+ void Finalize() override {}
+ void Start(bool resume = false) override {}
+ void Stop() override {}
+ void AppendBuffer([[maybe_unused]] ::AudioCore::Sink::SinkBuffer& buffer,
+ [[maybe_unused]] std::vector<s16>& samples) override {}
+ std::vector<s16> ReleaseBuffer([[maybe_unused]] u64 num_samples) override {
+ return {};
+ }
+ bool IsBufferConsumed([[maybe_unused]] const u64 tag) {
+ return true;
+ }
+ void ClearQueue() override {}
+ } null_sink_stream;
+};
+
+} // namespace AudioCore::Sink