29 lines
928 B
C#
29 lines
928 B
C#
using FluidSim.Components;
|
|
using FluidSim.Interfaces;
|
|
using System;
|
|
|
|
namespace FluidSim.Audio
|
|
{
|
|
public static class SoundProcessor
|
|
{
|
|
public static float MaxDeltaP { get; set; } = 100_000f;
|
|
public static float MaxArea { get; set; } = 1e-4f;
|
|
public static float MaxVelocity { get; set; } = 343f;
|
|
public static float ReferenceDensity { get; set; } = 1.225f;
|
|
public static float ReferenceSpeedOfSound { get; set; } = 343f;
|
|
public static float Gain { get; set; } = 1.0f;
|
|
|
|
public static double ComputeSample(Connection conn)
|
|
{
|
|
Port portA = conn.PortA;
|
|
Port portB = conn.PortB;
|
|
|
|
double pressureUp = portA.Pressure;
|
|
double pressureDown = portB.Pressure;
|
|
|
|
// No flow or no pressure drop → silence
|
|
double deltaP = pressureUp - pressureDown;
|
|
return deltaP / 1;
|
|
}
|
|
}
|
|
} |