summaryrefslogtreecommitdiffstats
path: root/src/audio_core/audio_out.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-07-28 19:44:50 +0200
committerbunnei <bunneidev@gmail.com>2018-07-31 03:45:24 +0200
commitf437c11caf2c1afc0b7d0fdb808be10d7b1adfcf (patch)
treee5224d2e6b57c5ac0aec46377d6bfae9072ab820 /src/audio_core/audio_out.cpp
parentaudio_core: Add interfaces for Sink and SinkStream. (diff)
downloadyuzu-f437c11caf2c1afc0b7d0fdb808be10d7b1adfcf.tar
yuzu-f437c11caf2c1afc0b7d0fdb808be10d7b1adfcf.tar.gz
yuzu-f437c11caf2c1afc0b7d0fdb808be10d7b1adfcf.tar.bz2
yuzu-f437c11caf2c1afc0b7d0fdb808be10d7b1adfcf.tar.lz
yuzu-f437c11caf2c1afc0b7d0fdb808be10d7b1adfcf.tar.xz
yuzu-f437c11caf2c1afc0b7d0fdb808be10d7b1adfcf.tar.zst
yuzu-f437c11caf2c1afc0b7d0fdb808be10d7b1adfcf.zip
Diffstat (limited to 'src/audio_core/audio_out.cpp')
-rw-r--r--src/audio_core/audio_out.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/audio_core/audio_out.cpp b/src/audio_core/audio_out.cpp
index 43414f197..77cedb6ba 100644
--- a/src/audio_core/audio_out.cpp
+++ b/src/audio_core/audio_out.cpp
@@ -3,6 +3,8 @@
// Refer to the license.txt file included.
#include "audio_core/audio_out.h"
+#include "audio_core/sink.h"
+#include "audio_core/sink_details.h"
#include "common/assert.h"
#include "common/logging/log.h"
@@ -26,9 +28,14 @@ static Stream::Format ChannelsToStreamFormat(u32 num_channels) {
StreamPtr AudioOut::OpenStream(u32 sample_rate, u32 num_channels,
Stream::ReleaseCallback&& release_callback) {
- streams.push_back(std::make_shared<Stream>(sample_rate, ChannelsToStreamFormat(num_channels),
- std::move(release_callback)));
- return streams.back();
+ if (!sink) {
+ const SinkDetails& sink_details = GetSinkDetails("auto");
+ sink = sink_details.factory("");
+ }
+
+ return std::make_shared<Stream>(sample_rate, ChannelsToStreamFormat(num_channels),
+ std::move(release_callback),
+ sink->AcquireSinkStream(sample_rate, num_channels));
}
std::vector<u64> AudioOut::GetTagsAndReleaseBuffers(StreamPtr stream, size_t max_count) {