budnhead/org.budnhead/audio/AudioDelegate.cs

82 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Threading;
using OpenTK.Audio;
using OpenTK.Audio.OpenAL;
using OpenTK;
namespace org.budnhead.audio
{
public static class AudioDelegate
{
//private static bool debug = true;
public static AudioContext context = new AudioContext();
//public static EffectsExtension efx = new EffectsExtension();
/* <<<<<<<<<<<INITIALIZE>>>>>>>>>>> */
public static void init()
{
nhBuffers.init();
DistanceModel();
//nhAux reverb = new nhAux();
Console.WriteLine("org.budnhead.audio initialized.");
}
public static void test()
{
nhPlayer testPlayer = new nhPlayer();
testPlayer.play(nhBuffers.buffers["st1"]);
}
public static void DistanceModel(string distanceModel = "exponential", bool clamped = false)
{
if (!clamped)
{
switch (distanceModel)
{
case "exponential":
AL.DistanceModel(ALDistanceModel.ExponentDistance);
break;
case "inverse":
AL.DistanceModel(ALDistanceModel.InverseDistance);
break;
case "linear":
AL.DistanceModel(ALDistanceModel.LinearDistance);
break;
}
}
else if (clamped)
{
switch (distanceModel)
{
case "exponential":
AL.DistanceModel(ALDistanceModel.ExponentDistanceClamped);
break;
case "inverse":
AL.DistanceModel(ALDistanceModel.InverseDistanceClamped);
break;
case "linear":
AL.DistanceModel(ALDistanceModel.LinearDistanceClamped);
break;
}
}
else
{
throw new NotSupportedException("DistanceModel not supported!");
}
}
}
}