diff options
| author | 2018-07-28 13:44:50 -0400 | |
|---|---|---|
| committer | 2018-07-30 21:45:24 -0400 | |
| commit | f437c11caf2c1afc0b7d0fdb808be10d7b1adfcf (patch) | |
| tree | e5224d2e6b57c5ac0aec46377d6bfae9072ab820 /src/audio_core/audio_out.cpp | |
| parent | audio_core: Add interfaces for Sink and SinkStream. (diff) | |
| download | yuzu-f437c11caf2c1afc0b7d0fdb808be10d7b1adfcf.tar.gz yuzu-f437c11caf2c1afc0b7d0fdb808be10d7b1adfcf.tar.xz yuzu-f437c11caf2c1afc0b7d0fdb808be10d7b1adfcf.zip | |
audio_core: Implement Sink and SinkStream interfaces with cubeb.
Diffstat (limited to 'src/audio_core/audio_out.cpp')
| -rw-r--r-- | src/audio_core/audio_out.cpp | 13 |
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 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "audio_core/audio_out.h" | 5 | #include "audio_core/audio_out.h" |
| 6 | #include "audio_core/sink.h" | ||
| 7 | #include "audio_core/sink_details.h" | ||
| 6 | #include "common/assert.h" | 8 | #include "common/assert.h" |
| 7 | #include "common/logging/log.h" | 9 | #include "common/logging/log.h" |
| 8 | 10 | ||
| @@ -26,9 +28,14 @@ static Stream::Format ChannelsToStreamFormat(u32 num_channels) { | |||
| 26 | 28 | ||
| 27 | StreamPtr AudioOut::OpenStream(u32 sample_rate, u32 num_channels, | 29 | StreamPtr AudioOut::OpenStream(u32 sample_rate, u32 num_channels, |
| 28 | Stream::ReleaseCallback&& release_callback) { | 30 | Stream::ReleaseCallback&& release_callback) { |
| 29 | streams.push_back(std::make_shared<Stream>(sample_rate, ChannelsToStreamFormat(num_channels), | 31 | if (!sink) { |
| 30 | std::move(release_callback))); | 32 | const SinkDetails& sink_details = GetSinkDetails("auto"); |
| 31 | return streams.back(); | 33 | sink = sink_details.factory(""); |
| 34 | } | ||
| 35 | |||
| 36 | return std::make_shared<Stream>(sample_rate, ChannelsToStreamFormat(num_channels), | ||
| 37 | std::move(release_callback), | ||
| 38 | sink->AcquireSinkStream(sample_rate, num_channels)); | ||
| 32 | } | 39 | } |
| 33 | 40 | ||
| 34 | std::vector<u64> AudioOut::GetTagsAndReleaseBuffers(StreamPtr stream, size_t max_count) { | 41 | std::vector<u64> AudioOut::GetTagsAndReleaseBuffers(StreamPtr stream, size_t max_count) { |