blob: 47a342171970271435feba37c4443df0090093af (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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
|