diff options
| author | bunnei <bunneidev@gmail.com> | 2022-09-10 11:01:11 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-10 11:01:11 -0700 |
| commit | cd4b9bffb2d42b1f8d4386b251a35344891df55a (patch) | |
| tree | 53454fa29c30e9fa7f1f2c31f9586839d799f277 /src/audio_core/device/device_session.h | |
| parent | 16080b6e4e28b49e0e320879ebbab34199fb81c2 (diff) | |
| parent | 2129d040a509754839b82b1ff6d387cb4f84f168 (diff) | |
Merge pull request #8842 from Kelebek1/AudOut
[audio_core] Rework audio output
Diffstat (limited to 'src/audio_core/device/device_session.h')
| -rw-r--r-- | src/audio_core/device/device_session.h | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/audio_core/device/device_session.h b/src/audio_core/device/device_session.h index 4a031b765..3414e2c06 100644 --- a/src/audio_core/device/device_session.h +++ b/src/audio_core/device/device_session.h @@ -3,6 +3,9 @@ #pragma once +#include <chrono> +#include <memory> +#include <optional> #include <span> #include "audio_core/common/common.h" @@ -11,9 +14,13 @@ namespace Core { class System; -} +namespace Timing { +struct EventType; +} // namespace Timing +} // namespace Core namespace AudioCore { + namespace Sink { class SinkStream; struct SinkBuffer; @@ -70,7 +77,7 @@ public: * @param tag - Unqiue tag of the buffer to check. * @return true if the buffer has been consumed, otherwise false. */ - bool IsBufferConsumed(u64 tag) const; + bool IsBufferConsumed(AudioBuffer& buffer) const; /** * Start this device session, starting the backend stream. @@ -96,6 +103,16 @@ public: */ u64 GetPlayedSampleCount() const; + /* + * CoreTiming callback to increment played_sample_count over time. + */ + std::optional<std::chrono::nanoseconds> ThreadFunc(); + + /* + * Set the size of the ring buffer. + */ + void SetRingSize(u32 ring_size); + private: /// System Core::System& system; @@ -118,9 +135,13 @@ private: /// Applet resource user id of this device session u64 applet_resource_user_id{}; /// Total number of samples played by this device session - u64 played_sample_count{}; + std::atomic<u64> played_sample_count{}; + /// Event increasing the played sample count every 5ms + std::shared_ptr<Core::Timing::EventType> thread_event; /// Is this session initialised? bool initialized{}; + /// Buffer queue + std::vector<AudioBuffer> buffer_queue{}; }; } // namespace AudioCore |
