using Core.Interfaces; using System.Collections.Concurrent; namespace Parsons.SteamDeck { public class RaylibAudioPlayer : IAudioDevice { private ConcurrentQueue _sampleQueue = new ConcurrentQueue(); public void AddSample(float sample) { // Queue the sample from the emulator core _sampleQueue.Enqueue(sample); } public float[] GetQueuedSamples() { // Pull all pending samples out of the queue to send to the sound card int count = _sampleQueue.Count; float[] buffer = new float[count]; for (int i = 0; i < count; i++) { _sampleQueue.TryDequeue(out buffer[i]); } return buffer; } } }