engine almost working, backup before adding gas types.

This commit is contained in:
max
2026-05-07 20:07:15 +02:00
parent 14f5ba925f
commit 92d84eacfe
18 changed files with 1236 additions and 587 deletions

45
Audio/SoundEngine.cs Normal file
View File

@@ -0,0 +1,45 @@
namespace FluidSim.Audio
{
public class SoundEngine : IDisposable
{
private readonly AudioOutputStream _stream;
private bool _isPlaying;
public SoundEngine(SimulationRingBuffer sourceBuffer, int bufferCapacity = 16384)
{
_stream = new AudioOutputStream(sourceBuffer);
}
public void Start()
{
if (_isPlaying) return;
_stream.Play();
_isPlaying = true;
}
public void Stop()
{
if (!_isPlaying) return;
_stream.Stop();
_isPlaying = false;
}
public double Speed
{
get => _stream.Speed;
set => _stream.Speed = value;
}
public float Volume
{
get => _stream.Volume;
set => _stream.Volume = value;
}
public void Dispose()
{
Stop();
_stream.Dispose();
}
}
}