Browse Source
[audio] Fix release buffer for audio input (#3336)
fixes microphone release buffer and data. Tested with Let's Sing 2025
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3336
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Co-authored-by: Maufeat <sahyno1996@gmail.com>
Co-committed-by: Maufeat <sahyno1996@gmail.com>
pull/3338/head
Maufeat
3 weeks ago
committed by
crueter
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
2 changed files with
13 additions and
1 deletions
-
src/audio_core/device/audio_buffers.h
-
src/audio_core/sink/sink_stream.cpp
|
|
@ -113,6 +113,8 @@ public: |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
session.ReleaseBuffer(buffers[index]); |
|
|
|
|
|
|
|
|
ReleaseBuffer(index, core_timing.GetGlobalTimeNs().count()); |
|
|
ReleaseBuffer(index, core_timing.GetGlobalTimeNs().count()); |
|
|
buffer_released = true; |
|
|
buffer_released = true; |
|
|
} |
|
|
} |
|
|
|
|
|
@ -151,9 +151,19 @@ void SinkStream::ProcessAudioIn(std::span<const s16> input_buffer, std::size_t n |
|
|
playing_buffer.consumed = true; |
|
|
playing_buffer.consumed = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (frames_written > 0) { |
|
|
std::memcpy(&last_frame[0], &input_buffer[(frames_written - 1) * frame_size], frame_size_bytes); |
|
|
std::memcpy(&last_frame[0], &input_buffer[(frames_written - 1) * frame_size], frame_size_bytes); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// update sample counts für audio-ins
|
|
|
|
|
|
{ |
|
|
|
|
|
std::scoped_lock lk{sample_count_lock}; |
|
|
|
|
|
last_sample_count_update_time = system.CoreTiming().GetGlobalTimeNs(); |
|
|
|
|
|
min_played_sample_count = max_played_sample_count; |
|
|
|
|
|
max_played_sample_count += frames_written; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::size_t num_frames) { |
|
|
void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::size_t num_frames) { |
|
|
const std::size_t num_channels = GetDeviceChannels(); |
|
|
const std::size_t num_channels = GetDeviceChannels(); |
|
|
const std::size_t frame_size = num_channels; |
|
|
const std::size_t frame_size = num_channels; |
|
|
|