75 lines
1.3 KiB
C#
75 lines
1.3 KiB
C#
|
using System;
|
|||
|
using OpenTK;
|
|||
|
using OpenTK.Audio;
|
|||
|
using OpenTK.Audio.OpenAL;
|
|||
|
|
|||
|
|
|||
|
namespace org.budnhead.audio
|
|||
|
|
|||
|
{
|
|||
|
public static class nhListener
|
|||
|
{
|
|||
|
|
|||
|
private static Vector3 _pos = new Vector3(0.0f, 0.0f, 0.0f);
|
|||
|
private static Vector3 _vel = new Vector3(0.0f, 0.0f, 0.0f);
|
|||
|
|
|||
|
private static Vector3 _top = new Vector3(0.0f, 0.0f, -1.0f);
|
|||
|
private static Vector3 _view = new Vector3(0.0f, 1.0f, 0.0f);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
private static void _setValues()
|
|||
|
{
|
|||
|
AL.Listener(ALListener3f.Position, _pos.X, _pos.Y, _pos.Z);
|
|||
|
AL.Listener(ALListener3f.Velocity, _vel.X, _vel.Y, _vel.Z);
|
|||
|
AL.Listener(ALListenerfv.Orientation, ref _view, ref _top);
|
|||
|
Console.WriteLine("listener:" + _pos);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
public static void setListener(Vector3 position, Vector3 velocity, Vector3 orientationUp, Vector3 orientationAt)
|
|||
|
{
|
|||
|
|
|||
|
_pos = position;
|
|||
|
_vel = velocity;
|
|||
|
_top = orientationUp;
|
|||
|
_view = orientationAt;
|
|||
|
|
|||
|
_setValues();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public static void setPosition(Vector3 position)
|
|||
|
{
|
|||
|
_pos = position;
|
|||
|
|
|||
|
_setValues();
|
|||
|
}
|
|||
|
|
|||
|
public static void setVelocity(Vector3 velocity)
|
|||
|
{
|
|||
|
_vel = velocity;
|
|||
|
|
|||
|
_setValues();
|
|||
|
}
|
|||
|
|
|||
|
public static void setTop(Vector3 Top)
|
|||
|
{
|
|||
|
_top = Top;
|
|||
|
_setValues();
|
|||
|
}
|
|||
|
|
|||
|
public static void setView(Vector3 View)
|
|||
|
{
|
|||
|
_view = View;
|
|||
|
_setValues();
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|