summaryrefslogtreecommitdiffstats
path: root/src/audio_core/stream.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/audio_core/stream.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp
index 63edc6c8d..689f51a1d 100644
--- a/src/audio_core/stream.cpp
+++ b/src/audio_core/stream.cpp
@@ -7,6 +7,8 @@
#include "core/core_timing.h"
#include "core/core_timing_util.h"
+#include "audio_core/sink.h"
+#include "audio_core/sink_details.h"
#include "audio_core/stream.h"
namespace AudioCore {
@@ -31,6 +33,11 @@ u32 Stream::GetSampleSize() const {
return GetNumChannels() * 2;
}
+Stream::Stream(u32 sample_rate, Format format, ReleaseCallback&& release_callback,
+ SinkStream& sink_stream)
+ : sample_rate{sample_rate}, format{format}, release_callback{std::move(release_callback)},
+ sink_stream{sink_stream} {
+
release_event = CoreTiming::RegisterEvent(
"Stream::Release", [this](u64 userdata, int cycles_late) { ReleaseActiveBuffer(); });
}
@@ -68,6 +75,10 @@ void Stream::PlayNextBuffer() {
active_buffer = queued_buffers.front();
queued_buffers.pop();
+ sink_stream.EnqueueSamples(GetNumChannels(),
+ reinterpret_cast<const s16*>(active_buffer->GetData().data()),
+ active_buffer->GetData().size() / GetSampleSize());
+
CoreTiming::ScheduleEventThreadsafe(GetBufferReleaseCycles(*active_buffer), release_event, {});
}