First OS Agnostic Commit

This commit is contained in:
2026-05-31 00:24:14 +01:00
parent 2f332ff224
commit 2300e2931e
4 changed files with 182 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
using Core.Interfaces;
using System.Collections.Concurrent;
namespace Parsons.SteamDeck
{
public class RaylibAudioPlayer : IAudioDevice
{
private ConcurrentQueue<float> _sampleQueue = new ConcurrentQueue<float>();
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;
}
}
}