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/stream.h | |
| 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/stream.h')
| -rw-r--r-- | src/audio_core/stream.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/audio_core/stream.h b/src/audio_core/stream.h index 5c1005899..35253920e 100644 --- a/src/audio_core/stream.h +++ b/src/audio_core/stream.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <queue> | 10 | #include <queue> |
| 11 | 11 | ||
| 12 | #include "audio_core/buffer.h" | 12 | #include "audio_core/buffer.h" |
| 13 | #include "audio_core/sink_stream.h" | ||
| 13 | #include "common/assert.h" | 14 | #include "common/assert.h" |
| 14 | #include "common/common_types.h" | 15 | #include "common/common_types.h" |
| 15 | #include "core/core_timing.h" | 16 | #include "core/core_timing.h" |
| @@ -31,7 +32,8 @@ public: | |||
| 31 | /// Callback function type, used to change guest state on a buffer being released | 32 | /// Callback function type, used to change guest state on a buffer being released |
| 32 | using ReleaseCallback = std::function<void()>; | 33 | using ReleaseCallback = std::function<void()>; |
| 33 | 34 | ||
| 34 | Stream(int sample_rate, Format format, ReleaseCallback&& release_callback); | 35 | Stream(u32 sample_rate, Format format, ReleaseCallback&& release_callback, |
| 36 | SinkStream& sink_stream); | ||
| 35 | 37 | ||
| 36 | /// Plays the audio stream | 38 | /// Plays the audio stream |
| 37 | void Play(); | 39 | void Play(); |
| @@ -85,7 +87,7 @@ private: | |||
| 85 | /// Gets the number of core cycles when the specified buffer will be released | 87 | /// Gets the number of core cycles when the specified buffer will be released |
| 86 | s64 GetBufferReleaseCycles(const Buffer& buffer) const; | 88 | s64 GetBufferReleaseCycles(const Buffer& buffer) const; |
| 87 | 89 | ||
| 88 | int sample_rate; ///< Sample rate of the stream | 90 | u32 sample_rate; ///< Sample rate of the stream |
| 89 | Format format; ///< Format of the stream | 91 | Format format; ///< Format of the stream |
| 90 | ReleaseCallback release_callback; ///< Buffer release callback for the stream | 92 | ReleaseCallback release_callback; ///< Buffer release callback for the stream |
| 91 | State state{State::Stopped}; ///< Playback state of the stream | 93 | State state{State::Stopped}; ///< Playback state of the stream |
| @@ -93,6 +95,7 @@ private: | |||
| 93 | BufferPtr active_buffer; ///< Actively playing buffer in the stream | 95 | BufferPtr active_buffer; ///< Actively playing buffer in the stream |
| 94 | std::queue<BufferPtr> queued_buffers; ///< Buffers queued to be played in the stream | 96 | std::queue<BufferPtr> queued_buffers; ///< Buffers queued to be played in the stream |
| 95 | std::queue<BufferPtr> released_buffers; ///< Buffers recently released from the stream | 97 | std::queue<BufferPtr> released_buffers; ///< Buffers recently released from the stream |
| 98 | SinkStream& sink_stream; ///< Output sink for the stream | ||
| 96 | }; | 99 | }; |
| 97 | 100 | ||
| 98 | using StreamPtr = std::shared_ptr<Stream>; | 101 | using StreamPtr = std::shared_ptr<Stream>; |