diff options
-rw-r--r-- | src/audio_core/audio_out.cpp | 2 | ||||
-rw-r--r-- | src/audio_core/cubeb_sink.cpp | 11 | ||||
-rw-r--r-- | src/audio_core/cubeb_sink.h | 3 | ||||
-rw-r--r-- | src/audio_core/null_sink.h | 3 | ||||
-rw-r--r-- | src/audio_core/sink.h | 4 |
5 files changed, 14 insertions, 9 deletions
diff --git a/src/audio_core/audio_out.cpp b/src/audio_core/audio_out.cpp index 5cf665c22..eb9db755a 100644 --- a/src/audio_core/audio_out.cpp +++ b/src/audio_core/audio_out.cpp @@ -36,7 +36,7 @@ StreamPtr AudioOut::OpenStream(u32 sample_rate, u32 num_channels, std::string&& return std::make_shared<Stream>( sample_rate, ChannelsToStreamFormat(num_channels), std::move(release_callback), - sink->AcquireSinkStream(sample_rate, num_channels), std::move(name)); + sink->AcquireSinkStream(sample_rate, num_channels, name), std::move(name)); } std::vector<Buffer::Tag> AudioOut::GetTagsAndReleaseBuffers(StreamPtr stream, size_t max_count) { diff --git a/src/audio_core/cubeb_sink.cpp b/src/audio_core/cubeb_sink.cpp index 34ae5b062..cf4839989 100644 --- a/src/audio_core/cubeb_sink.cpp +++ b/src/audio_core/cubeb_sink.cpp @@ -13,7 +13,7 @@ namespace AudioCore { class SinkStreamImpl final : public SinkStream { public: - SinkStreamImpl(cubeb* ctx, cubeb_devid output_device) : ctx{ctx} { + SinkStreamImpl(cubeb* ctx, cubeb_devid output_device, const std::string& name) : ctx{ctx} { cubeb_stream_params params; params.rate = 48000; params.channels = GetNumChannels(); @@ -25,8 +25,8 @@ public: LOG_CRITICAL(Audio_Sink, "Error getting minimum latency"); } - if (cubeb_stream_init(ctx, &stream_backend, "yuzu Audio Output", nullptr, nullptr, - output_device, ¶ms, std::max(512u, minimum_latency), + if (cubeb_stream_init(ctx, &stream_backend, name.c_str(), nullptr, nullptr, output_device, + ¶ms, std::max(512u, minimum_latency), &SinkStreamImpl::DataCallback, &SinkStreamImpl::StateCallback, this) != CUBEB_OK) { LOG_CRITICAL(Audio_Sink, "Error initializing cubeb stream"); @@ -129,8 +129,9 @@ CubebSink::~CubebSink() { cubeb_destroy(ctx); } -SinkStream& CubebSink::AcquireSinkStream(u32 sample_rate, u32 num_channels) { - sink_streams.push_back(std::make_unique<SinkStreamImpl>(ctx, output_device)); +SinkStream& CubebSink::AcquireSinkStream(u32 sample_rate, u32 num_channels, + const std::string& name) { + sink_streams.push_back(std::make_unique<SinkStreamImpl>(ctx, output_device, name)); return *sink_streams.back(); } diff --git a/src/audio_core/cubeb_sink.h b/src/audio_core/cubeb_sink.h index d07113f1f..59cbf05e9 100644 --- a/src/audio_core/cubeb_sink.h +++ b/src/audio_core/cubeb_sink.h @@ -18,7 +18,8 @@ public: explicit CubebSink(std::string device_id); ~CubebSink() override; - SinkStream& AcquireSinkStream(u32 sample_rate, u32 num_channels) override; + SinkStream& AcquireSinkStream(u32 sample_rate, u32 num_channels, + const std::string& name) override; private: cubeb* ctx{}; diff --git a/src/audio_core/null_sink.h b/src/audio_core/null_sink.h index 2e04438f7..66041ea3f 100644 --- a/src/audio_core/null_sink.h +++ b/src/audio_core/null_sink.h @@ -13,7 +13,8 @@ public: explicit NullSink(std::string){}; ~NullSink() override = default; - SinkStream& AcquireSinkStream(u32 /*sample_rate*/, u32 /*num_channels*/) override { + SinkStream& AcquireSinkStream(u32 /*sample_rate*/, u32 /*num_channels*/, + const std::string& /*name*/) override { return null_sink_stream; } diff --git a/src/audio_core/sink.h b/src/audio_core/sink.h index d1bb98c3d..95c7b2b6e 100644 --- a/src/audio_core/sink.h +++ b/src/audio_core/sink.h @@ -5,6 +5,7 @@ #pragma once #include <memory> +#include <string> #include "audio_core/sink_stream.h" #include "common/common_types.h" @@ -21,7 +22,8 @@ constexpr char auto_device_name[] = "auto"; class Sink { public: virtual ~Sink() = default; - virtual SinkStream& AcquireSinkStream(u32 sample_rate, u32 num_channels) = 0; + virtual SinkStream& AcquireSinkStream(u32 sample_rate, u32 num_channels, + const std::string& name) = 0; }; using SinkPtr = std::unique_ptr<Sink>; |