From bd983414f643b734a1f8bebe3183723733344f72 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 14 Feb 2019 12:42:58 -0500 Subject: core_timing: Convert core timing into a class Gets rid of the largest set of mutable global state within the core. This also paves a way for eliminating usages of GetInstance() on the System class as a follow-up. Note that no behavioral changes have been made, and this simply extracts the functionality into a class. This also has the benefit of making dependencies on the core timing functionality explicit within the relevant interfaces. --- src/audio_core/stream.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/audio_core/stream.h') diff --git a/src/audio_core/stream.h b/src/audio_core/stream.h index caa775544..05071243b 100644 --- a/src/audio_core/stream.h +++ b/src/audio_core/stream.h @@ -14,8 +14,9 @@ #include "common/common_types.h" namespace Core::Timing { +class CoreTiming; struct EventType; -} +} // namespace Core::Timing namespace AudioCore { @@ -42,8 +43,8 @@ public: /// Callback function type, used to change guest state on a buffer being released using ReleaseCallback = std::function; - Stream(u32 sample_rate, Format format, ReleaseCallback&& release_callback, - SinkStream& sink_stream, std::string&& name_); + Stream(Core::Timing::CoreTiming& core_timing, u32 sample_rate, Format format, + ReleaseCallback&& release_callback, SinkStream& sink_stream, std::string&& name_); /// Plays the audio stream void Play(); @@ -100,6 +101,7 @@ private: std::queue queued_buffers; ///< Buffers queued to be played in the stream std::queue released_buffers; ///< Buffers recently released from the stream SinkStream& sink_stream; ///< Output sink for the stream + Core::Timing::CoreTiming& core_timing; ///< Core timing instance. std::string name; ///< Name of the stream, must be unique }; -- cgit v1.2.3