Fixed Listener's functions being private in SFML.Net

Added a function to set a sound's position relative to the listener

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1059 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
laurentgom 2009-03-22 18:36:03 +00:00
parent 631bcc8c5f
commit 40b4bda26b
20 changed files with 295 additions and 52 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -20,7 +20,7 @@ namespace SFML
/// Global volume of all sounds, in range [0 .. 100] (default is 100)
/// </summary>
////////////////////////////////////////////////////////////
static float GlobalVolume
public static float GlobalVolume
{
get {return sfListener_GetGlobalVolume();}
set {sfListener_SetGlobalVolume(value);}
@ -31,7 +31,7 @@ namespace SFML
/// 3D position of the listener (default is (0, 0, 0))
/// </summary>
////////////////////////////////////////////////////////////
static Vector3 Position
public static Vector3 Position
{
get {Vector3 v; sfListener_GetPosition(out v.X, out v.Y, out v.Z); return v;}
set {sfListener_SetPosition(value.X, value.Y, value.Z);}
@ -43,7 +43,7 @@ namespace SFML
/// (default is (0, 0, -1))
/// </summary>
////////////////////////////////////////////////////////////
static Vector3 Target
public static Vector3 Target
{
get {Vector3 v; sfListener_GetTarget(out v.X, out v.Y, out v.Z); return v;}
set {sfListener_SetTarget(value.X, value.Y, value.Z);}

View file

@ -165,6 +165,19 @@ namespace SFML
set {sfMusic_SetPosition(This, value.X, value.Y, value.Z);}
}
////////////////////////////////////////////////////////////
/// <summary>
/// Is the music's position relative to the listener's position,
/// or is it absolute?
/// Default value is false (absolute)
/// </summary>
////////////////////////////////////////////////////////////
public bool RelativeToListener
{
get {return sfMusic_IsRelativeToListener(This);}
set {sfMusic_SetRelativeToListener(This, value);}
}
////////////////////////////////////////////////////////////
/// <summary>
/// Minimum distance of the music. Closer than this distance,
@ -213,70 +226,76 @@ namespace SFML
}
#region Imports
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern IntPtr sfMusic_CreateFromFile(string Filename);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
unsafe static extern IntPtr sfMusic_CreateFromMemory(char* Data, uint SizeInBytes);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_Destroy(IntPtr MusicStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_Play(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_Pause(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_Stop(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern SoundStatus sfMusic_GetStatus(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfMusic_GetDuration(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern uint sfMusic_GetChannelsCount(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern uint sfMusic_GetSampleRate(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_SetPitch(IntPtr Music, float Pitch);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_SetLoop(IntPtr Music, bool Loop);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_SetVolume(IntPtr Music, float Volume);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_SetPosition(IntPtr Music, float X, float Y, float Z);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_SetRelativeToListener(IntPtr Music, bool Relative);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_SetMinDistance(IntPtr Music, float MinDistance);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_SetAttenuation(IntPtr Music, float Attenuation);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern bool sfMusic_GetLoop(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfMusic_GetPitch(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfMusic_GetVolume(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_GetPosition(IntPtr Music, out float X, out float Y, out float Z);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern bool sfMusic_IsRelativeToListener(IntPtr Music);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfMusic_GetMinDistance(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfMusic_GetAttenuation(IntPtr Music);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]

View file

@ -159,6 +159,19 @@ namespace SFML
set {sfSound_SetPosition(This, value.X, value.Y, value.Z);}
}
////////////////////////////////////////////////////////////
/// <summary>
/// Is the sound's position relative to the listener's position,
/// or is it absolute?
/// Default value is false (absolute)
/// </summary>
////////////////////////////////////////////////////////////
public bool RelativeToListener
{
get {return sfSound_IsRelativeToListener(This);}
set {sfSound_SetRelativeToListener(This, value);}
}
////////////////////////////////////////////////////////////
/// <summary>
/// Minimum distance of the sound. Closer than this distance,
@ -238,6 +251,9 @@ namespace SFML
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSound_SetPosition(IntPtr Sound, float X, float Y, float Z);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSound_SetRelativeToListener(IntPtr Sound, bool Relative);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSound_SetMinDistance(IntPtr Sound, float MinDistance);
@ -256,6 +272,9 @@ namespace SFML
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSound_GetPosition(IntPtr Sound, out float X, out float Y, out float Z);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern bool sfSound_IsRelativeToListener(IntPtr Sound);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfSound_GetMinDistance(IntPtr Sound);

View file

@ -157,22 +157,22 @@ namespace SFML
private StopCallback myStopCallback;
#region Imports
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern IntPtr sfSoundRecorder_Create(StartCallback OnStart, ProcessCallback OnProcess, StopCallback OnStop, IntPtr UserData);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundRecorder_Destroy(IntPtr SoundRecorder);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundRecorder_Start(IntPtr SoundRecorder, uint SampleRate);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundRecorder_Stop(IntPtr SoundRecorder);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern uint sfSoundRecorder_GetSampleRate(IntPtr SoundRecorder);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern bool sfSoundRecorder_CanCapture();
#endregion
}

View file

@ -130,6 +130,19 @@ namespace SFML
set {sfSoundStream_SetPosition(This, value.X, value.Y, value.Z);}
}
////////////////////////////////////////////////////////////
/// <summary>
/// Is the sound stream's position relative to the listener's position,
/// or is it absolute?
/// Default value is false (absolute)
/// </summary>
////////////////////////////////////////////////////////////
public bool RelativeToListener
{
get {return sfSoundStream_IsRelativeToListener(This);}
set {sfSoundStream_SetRelativeToListener(This, value);}
}
////////////////////////////////////////////////////////////
/// <summary>
/// Minimum distance of the sound stream. Closer than this distance,
@ -275,64 +288,70 @@ namespace SFML
private short[] myTempBuffer;
#region Imports
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern IntPtr sfSoundStream_Create(StartCallbackType OnStart, GetDataCallbackType OnGetData, uint ChannelsCount, uint SampleRate, IntPtr UserData);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_Destroy(IntPtr SoundStreamStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_Play(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_Pause(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_Stop(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern SoundStatus sfSoundStream_GetStatus(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern uint sfSoundStream_GetChannelsCount(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern uint sfSoundStream_GetSampleRate(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_SetLoop(IntPtr SoundStream, bool Loop);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_SetPitch(IntPtr SoundStream, float Pitch);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_SetVolume(IntPtr SoundStream, float Volume);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_SetPosition(IntPtr SoundStream, float X, float Y, float Z);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_SetRelativeToListener(IntPtr SoundStream, bool Relative);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_SetMinDistance(IntPtr SoundStream, float MinDistance);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_SetAttenuation(IntPtr SoundStream, float Attenuation);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern bool sfSoundStream_GetLoop(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfSoundStream_GetPitch(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfSoundStream_GetVolume(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_GetPosition(IntPtr SoundStream, out float X, out float Y, out float Z);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern bool sfSoundStream_IsRelativeToListener(IntPtr SoundStream);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfSoundStream_GetMinDistance(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfSoundStream_GetAttenuation(IntPtr SoundStream);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]

View file

@ -519,7 +519,7 @@ namespace SFML
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern void sfRenderWindow_EnableKeyRepeat(IntPtr This, bool Enable);
[DllImport("csfml-graphics")]
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
unsafe static extern void sfRenderWindow_SetIcon(IntPtr This, uint Width, uint Height, byte* Pixels);
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]