diff options
author | Kelebek1 <eeeedddccc@hotmail.co.uk> | 2021-06-21 19:17:12 +0200 |
---|---|---|
committer | Kelebek1 <eeeedddccc@hotmail.co.uk> | 2021-06-22 05:39:17 +0200 |
commit | ba3af04da1ba020bdbb7285c8da73f75fcba68cc (patch) | |
tree | 60e516f0db83ee9d2e6d2b4cf05671b721bce043 /src/audio_core | |
parent | Merge pull request #6486 from CaptV0rt3x/httplib (diff) | |
download | yuzu-ba3af04da1ba020bdbb7285c8da73f75fcba68cc.tar yuzu-ba3af04da1ba020bdbb7285c8da73f75fcba68cc.tar.gz yuzu-ba3af04da1ba020bdbb7285c8da73f75fcba68cc.tar.bz2 yuzu-ba3af04da1ba020bdbb7285c8da73f75fcba68cc.tar.lz yuzu-ba3af04da1ba020bdbb7285c8da73f75fcba68cc.tar.xz yuzu-ba3af04da1ba020bdbb7285c8da73f75fcba68cc.tar.zst yuzu-ba3af04da1ba020bdbb7285c8da73f75fcba68cc.zip |
Diffstat (limited to 'src/audio_core')
-rw-r--r-- | src/audio_core/stream.cpp | 7 | ||||
-rw-r--r-- | src/audio_core/stream.h | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp index ad6c587c2..5a30f55a7 100644 --- a/src/audio_core/stream.cpp +++ b/src/audio_core/stream.cpp @@ -107,9 +107,12 @@ void Stream::PlayNextBuffer(std::chrono::nanoseconds ns_late) { active_buffer = queued_buffers.front(); queued_buffers.pop(); - VolumeAdjustSamples(active_buffer->GetSamples(), game_volume); + auto& samples = active_buffer->GetSamples(); - sink_stream.EnqueueSamples(GetNumChannels(), active_buffer->GetSamples()); + VolumeAdjustSamples(samples, game_volume); + + sink_stream.EnqueueSamples(GetNumChannels(), samples); + played_samples += samples.size(); const auto buffer_release_ns = GetBufferReleaseNS(*active_buffer); diff --git a/src/audio_core/stream.h b/src/audio_core/stream.h index 559844b9b..dbd97ec9c 100644 --- a/src/audio_core/stream.h +++ b/src/audio_core/stream.h @@ -89,6 +89,11 @@ public: return sample_rate; } + /// Gets the number of samples played so far + [[nodiscard]] u64 GetPlayedSampleCount() const { + return played_samples; + } + /// Gets the number of channels [[nodiscard]] u32 GetNumChannels() const; @@ -106,6 +111,7 @@ private: [[nodiscard]] std::chrono::nanoseconds GetBufferReleaseNS(const Buffer& buffer) const; u32 sample_rate; ///< Sample rate of the stream + u64 played_samples{}; ///< The current played sample count Format format; ///< Format of the stream float game_volume = 1.0f; ///< The volume the game currently has set ReleaseCallback release_callback; ///< Buffer release callback for the stream |