diff options
Diffstat (limited to 'src/audio_core')
-rw-r--r-- | src/audio_core/common.h | 2 | ||||
-rw-r--r-- | src/audio_core/sink_context.h | 2 | ||||
-rw-r--r-- | src/audio_core/stream.cpp | 7 | ||||
-rw-r--r-- | src/audio_core/stream.h | 6 |
4 files changed, 14 insertions, 3 deletions
diff --git a/src/audio_core/common.h b/src/audio_core/common.h index fe546c55d..1ab537588 100644 --- a/src/audio_core/common.h +++ b/src/audio_core/common.h @@ -15,7 +15,7 @@ constexpr ResultCode ERR_INVALID_PARAMETERS{ErrorModule::Audio, 41}; constexpr ResultCode ERR_SPLITTER_SORT_FAILED{ErrorModule::Audio, 43}; } // namespace Audren -constexpr u32_le CURRENT_PROCESS_REVISION = Common::MakeMagic('R', 'E', 'V', '8'); +constexpr u32_le CURRENT_PROCESS_REVISION = Common::MakeMagic('R', 'E', 'V', '9'); constexpr std::size_t MAX_MIX_BUFFERS = 24; constexpr std::size_t MAX_BIQUAD_FILTERS = 2; constexpr std::size_t MAX_CHANNEL_COUNT = 6; diff --git a/src/audio_core/sink_context.h b/src/audio_core/sink_context.h index 66ee4e8a0..9e2b69785 100644 --- a/src/audio_core/sink_context.h +++ b/src/audio_core/sink_context.h @@ -4,6 +4,8 @@ #pragma once +#include <array> +#include <vector> #include "audio_core/common.h" #include "common/common_funcs.h" #include "common/common_types.h" 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 |