diff options
author | Lioncash <mathew1800@gmail.com> | 2022-09-16 15:29:28 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2022-09-16 15:31:33 +0200 |
commit | a278fa6e2a8e06bf20b608ec6a79a53c32321d9b (patch) | |
tree | 9cfa8b7247494d8ea71754571fd0981eaffc5c74 /src/audio_core/device | |
parent | Merge pull request #8878 from Kelebek1/remove_pause (diff) | |
download | yuzu-a278fa6e2a8e06bf20b608ec6a79a53c32321d9b.tar yuzu-a278fa6e2a8e06bf20b608ec6a79a53c32321d9b.tar.gz yuzu-a278fa6e2a8e06bf20b608ec6a79a53c32321d9b.tar.bz2 yuzu-a278fa6e2a8e06bf20b608ec6a79a53c32321d9b.tar.lz yuzu-a278fa6e2a8e06bf20b608ec6a79a53c32321d9b.tar.xz yuzu-a278fa6e2a8e06bf20b608ec6a79a53c32321d9b.tar.zst yuzu-a278fa6e2a8e06bf20b608ec6a79a53c32321d9b.zip |
Diffstat (limited to 'src/audio_core/device')
-rw-r--r-- | src/audio_core/device/audio_buffers.h | 2 | ||||
-rw-r--r-- | src/audio_core/device/device_session.cpp | 6 | ||||
-rw-r--r-- | src/audio_core/device/device_session.h | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/audio_core/device/audio_buffers.h b/src/audio_core/device/audio_buffers.h index 3ecbbb63f..4918a61c7 100644 --- a/src/audio_core/device/audio_buffers.h +++ b/src/audio_core/device/audio_buffers.h @@ -93,7 +93,7 @@ public: * * @return Is the buffer was released. */ - bool ReleaseBuffers(Core::Timing::CoreTiming& core_timing, DeviceSession& session) { + bool ReleaseBuffers(const Core::Timing::CoreTiming& core_timing, const DeviceSession& session) { std::scoped_lock l{lock}; bool buffer_released{false}; while (registered_count > 0) { diff --git a/src/audio_core/device/device_session.cpp b/src/audio_core/device/device_session.cpp index c71c3a376..6cde33f93 100644 --- a/src/audio_core/device/device_session.cpp +++ b/src/audio_core/device/device_session.cpp @@ -73,7 +73,7 @@ void DeviceSession::Stop() { } } -void DeviceSession::AppendBuffers(std::span<AudioBuffer> buffers) const { +void DeviceSession::AppendBuffers(std::span<const AudioBuffer> buffers) const { for (size_t i = 0; i < buffers.size(); i++) { Sink::SinkBuffer new_buffer{ .frames = buffers[i].size / (channel_count * sizeof(s16)), @@ -93,14 +93,14 @@ void DeviceSession::AppendBuffers(std::span<AudioBuffer> buffers) const { } } -void DeviceSession::ReleaseBuffer(AudioBuffer& buffer) const { +void DeviceSession::ReleaseBuffer(const AudioBuffer& buffer) const { if (type == Sink::StreamType::In) { auto samples{stream->ReleaseBuffer(buffer.size / sizeof(s16))}; system.Memory().WriteBlockUnsafe(buffer.samples, samples.data(), buffer.size); } } -bool DeviceSession::IsBufferConsumed(AudioBuffer& buffer) const { +bool DeviceSession::IsBufferConsumed(const AudioBuffer& buffer) const { return played_sample_count >= buffer.end_timestamp; } diff --git a/src/audio_core/device/device_session.h b/src/audio_core/device/device_session.h index 53b649c61..74f4dc085 100644 --- a/src/audio_core/device/device_session.h +++ b/src/audio_core/device/device_session.h @@ -62,14 +62,14 @@ public: * * @param buffers - The buffers to play. */ - void AppendBuffers(std::span<AudioBuffer> buffers) const; + void AppendBuffers(std::span<const AudioBuffer> buffers) const; /** * (Audio In only) Pop samples from the backend, and write them back to this buffer's address. * * @param buffer - The buffer to write to. */ - void ReleaseBuffer(AudioBuffer& buffer) const; + void ReleaseBuffer(const AudioBuffer& buffer) const; /** * Check if the buffer for the given tag has been consumed by the backend. @@ -78,7 +78,7 @@ public: * * @return true if the buffer has been consumed, otherwise false. */ - bool IsBufferConsumed(AudioBuffer& buffer) const; + bool IsBufferConsumed(const AudioBuffer& buffer) const; /** * Start this device session, starting the backend stream. |