57 lines
1.5 KiB
C++
57 lines
1.5 KiB
C++
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
#include "audio_core/sink/sink.h"
|
|
#include "audio_core/sink/sink_stream.h"
|
|
|
|
namespace Core {
|
|
class System;
|
|
} // namespace Core
|
|
|
|
namespace AudioCore::Sink {
|
|
class NullSinkStreamImpl final : public SinkStream {
|
|
public:
|
|
explicit NullSinkStreamImpl(Core::System& system_, StreamType type_)
|
|
: SinkStream{system_, type_} {}
|
|
~NullSinkStreamImpl() override {}
|
|
void AppendBuffer(SinkBuffer&, std::span<s16>) override {}
|
|
std::vector<s16> ReleaseBuffer(u64) override {
|
|
return {};
|
|
}
|
|
};
|
|
|
|
/**
|
|
* 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(Core::System& system, u32, const std::string&,
|
|
StreamType type) override {
|
|
if (null_sink == nullptr) {
|
|
null_sink = std::make_unique<NullSinkStreamImpl>(system, type);
|
|
}
|
|
return null_sink.get();
|
|
}
|
|
|
|
void CloseStream(SinkStream*) override {}
|
|
void CloseStreams() override {}
|
|
f32 GetDeviceVolume() const override {
|
|
return 1.0f;
|
|
}
|
|
void SetDeviceVolume(f32 volume) override {}
|
|
void SetSystemVolume(f32 volume) override {}
|
|
|
|
private:
|
|
SinkStreamPtr null_sink{};
|
|
};
|
|
|
|
} // namespace AudioCore::Sink
|