summaryrefslogtreecommitdiffstats
path: root/src/audio_core/stream.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-07-31 05:29:17 +0200
committerGitHub <noreply@github.com>2018-07-31 05:29:17 +0200
commitbf9c62bc76a2296c1a81cfc1b83aaf4028578901 (patch)
treedad8906c597af3f579d4f72f4c9f493503c40665 /src/audio_core/stream.h
parentPort #3758 from Citra (#852): Add missing std::string import in text_formatter (diff)
parentaudio_core: Implement Sink and SinkStream interfaces with cubeb. (diff)
downloadyuzu-bf9c62bc76a2296c1a81cfc1b83aaf4028578901.tar
yuzu-bf9c62bc76a2296c1a81cfc1b83aaf4028578901.tar.gz
yuzu-bf9c62bc76a2296c1a81cfc1b83aaf4028578901.tar.bz2
yuzu-bf9c62bc76a2296c1a81cfc1b83aaf4028578901.tar.lz
yuzu-bf9c62bc76a2296c1a81cfc1b83aaf4028578901.tar.xz
yuzu-bf9c62bc76a2296c1a81cfc1b83aaf4028578901.tar.zst
yuzu-bf9c62bc76a2296c1a81cfc1b83aaf4028578901.zip
Diffstat (limited to '')
-rw-r--r--src/audio_core/stream.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/audio_core/stream.h b/src/audio_core/stream.h
index 5f43b0798..35253920e 100644
--- a/src/audio_core/stream.h
+++ b/src/audio_core/stream.h
@@ -10,14 +10,13 @@
#include <queue>
#include "audio_core/buffer.h"
+#include "audio_core/sink_stream.h"
#include "common/assert.h"
#include "common/common_types.h"
#include "core/core_timing.h"
namespace AudioCore {
-using BufferPtr = std::shared_ptr<Buffer>;
-
/**
* Represents an audio stream, which is a sequence of queued buffers, to be outputed by AudioOut
*/
@@ -33,7 +32,8 @@ public:
/// Callback function type, used to change guest state on a buffer being released
using ReleaseCallback = std::function<void()>;
- Stream(int sample_rate, Format format, ReleaseCallback&& release_callback);
+ Stream(u32 sample_rate, Format format, ReleaseCallback&& release_callback,
+ SinkStream& sink_stream);
/// Plays the audio stream
void Play();
@@ -60,6 +60,17 @@ public:
return queued_buffers.size();
}
+ /// Gets the sample rate
+ u32 GetSampleRate() const {
+ return sample_rate;
+ }
+
+ /// Gets the number of channels
+ u32 GetNumChannels() const;
+
+ /// Gets the sample size in bytes
+ u32 GetSampleSize() const;
+
private:
/// Current state of the stream
enum class State {
@@ -76,7 +87,7 @@ private:
/// Gets the number of core cycles when the specified buffer will be released
s64 GetBufferReleaseCycles(const Buffer& buffer) const;
- int sample_rate; ///< Sample rate of the stream
+ u32 sample_rate; ///< Sample rate of the stream
Format format; ///< Format of the stream
ReleaseCallback release_callback; ///< Buffer release callback for the stream
State state{State::Stopped}; ///< Playback state of the stream
@@ -84,6 +95,9 @@ private:
BufferPtr active_buffer; ///< Actively playing buffer in the stream
std::queue<BufferPtr> queued_buffers; ///< Buffers queued to be played in the stream
std::queue<BufferPtr> released_buffers; ///< Buffers recently released from the stream
+ SinkStream& sink_stream; ///< Output sink for the stream
};
+using StreamPtr = std::shared_ptr<Stream>;
+
} // namespace AudioCore