diff options
author | Lioncash <mathew1800@gmail.com> | 2019-02-12 18:32:15 +0100 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2019-02-12 18:42:17 +0100 |
commit | 48d9d66dc585477d26b4cfbf1c4f71fd637b42ea (patch) | |
tree | f53430f173796e92b2e3dfd2570ed6752d5e8f77 /src/audio_core | |
parent | Merge pull request #1904 from bunnei/better-fermi-copy (diff) | |
download | yuzu-48d9d66dc585477d26b4cfbf1c4f71fd637b42ea.tar yuzu-48d9d66dc585477d26b4cfbf1c4f71fd637b42ea.tar.gz yuzu-48d9d66dc585477d26b4cfbf1c4f71fd637b42ea.tar.bz2 yuzu-48d9d66dc585477d26b4cfbf1c4f71fd637b42ea.tar.lz yuzu-48d9d66dc585477d26b4cfbf1c4f71fd637b42ea.tar.xz yuzu-48d9d66dc585477d26b4cfbf1c4f71fd637b42ea.tar.zst yuzu-48d9d66dc585477d26b4cfbf1c4f71fd637b42ea.zip |
Diffstat (limited to 'src/audio_core')
-rw-r--r-- | src/audio_core/stream.cpp | 7 | ||||
-rw-r--r-- | src/audio_core/stream.h | 22 |
2 files changed, 15 insertions, 14 deletions
diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp index 4ce2d374e..8ab5649df 100644 --- a/src/audio_core/stream.cpp +++ b/src/audio_core/stream.cpp @@ -37,7 +37,7 @@ Stream::Stream(u32 sample_rate, Format format, ReleaseCallback&& release_callbac : sample_rate{sample_rate}, format{format}, release_callback{std::move(release_callback)}, sink_stream{sink_stream}, name{std::move(name_)} { - release_event = CoreTiming::RegisterEvent( + release_event = Core::Timing::RegisterEvent( name, [this](u64 userdata, int cycles_late) { ReleaseActiveBuffer(); }); } @@ -57,7 +57,7 @@ Stream::State Stream::GetState() const { s64 Stream::GetBufferReleaseCycles(const Buffer& buffer) const { const std::size_t num_samples{buffer.GetSamples().size() / GetNumChannels()}; - return CoreTiming::usToCycles((static_cast<u64>(num_samples) * 1000000) / sample_rate); + return Core::Timing::usToCycles((static_cast<u64>(num_samples) * 1000000) / sample_rate); } static void VolumeAdjustSamples(std::vector<s16>& samples) { @@ -99,7 +99,8 @@ void Stream::PlayNextBuffer() { sink_stream.EnqueueSamples(GetNumChannels(), active_buffer->GetSamples()); - CoreTiming::ScheduleEventThreadsafe(GetBufferReleaseCycles(*active_buffer), release_event, {}); + Core::Timing::ScheduleEventThreadsafe(GetBufferReleaseCycles(*active_buffer), release_event, + {}); } void Stream::ReleaseActiveBuffer() { diff --git a/src/audio_core/stream.h b/src/audio_core/stream.h index aebfeb51d..caa775544 100644 --- a/src/audio_core/stream.h +++ b/src/audio_core/stream.h @@ -13,7 +13,7 @@ #include "audio_core/buffer.h" #include "common/common_types.h" -namespace CoreTiming { +namespace Core::Timing { struct EventType; } @@ -91,16 +91,16 @@ private: /// Gets the number of core cycles when the specified buffer will be released s64 GetBufferReleaseCycles(const Buffer& buffer) const; - 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 - CoreTiming::EventType* release_event{}; ///< Core timing release event for the stream - 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 - std::string name; ///< Name of the stream, must be unique + 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 + Core::Timing::EventType* release_event{}; ///< Core timing release event for the stream + 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 + std::string name; ///< Name of the stream, must be unique }; using StreamPtr = std::shared_ptr<Stream>; |