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
parent
commit
84e11a52ba
No known key found for this signature in database GPG Key ID: 425ACD2D4830EBC6
  1. 2
      src/audio_core/device/audio_buffers.h
  2. 12
      src/audio_core/sink/sink_stream.cpp

2
src/audio_core/device/audio_buffers.h

@ -113,6 +113,8 @@ public:
break;
}
session.ReleaseBuffer(buffers[index]);
ReleaseBuffer(index, core_timing.GetGlobalTimeNs().count());
buffer_released = true;
}

12
src/audio_core/sink/sink_stream.cpp

@ -151,7 +151,17 @@ void SinkStream::ProcessAudioIn(std::span<const s16> input_buffer, std::size_t n
playing_buffer.consumed = true;
}
std::memcpy(&last_frame[0], &input_buffer[(frames_written - 1) * frame_size], frame_size_bytes);
if (frames_written > 0) {
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) {

Loading…
Cancel
Save