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

View File

@ -21,11 +21,13 @@ EXPORTS
sfMusic_SetPitch
sfMusic_SetVolume
sfMusic_SetPosition
sfMusic_SetRelativeToListener
sfMusic_SetMinDistance
sfMusic_SetAttenuation
sfMusic_GetPitch
sfMusic_GetVolume
sfMusic_GetPosition
sfMusic_IsRelativeToListener
sfMusic_GetMinDistance
sfMusic_GetAttenuation
sfMusic_GetPlayingOffset
@ -42,12 +44,14 @@ EXPORTS
sfSound_SetPitch
sfSound_SetVolume
sfSound_SetPosition
sfSound_SetRelativeToListener
sfSound_SetMinDistance
sfSound_SetAttenuation
sfSound_SetPlayingOffset
sfSound_GetPitch
sfSound_GetVolume
sfSound_GetPosition
sfSound_IsRelativeToListener
sfSound_GetPlayingOffset
sfSound_GetMinDistance
sfSound_GetAttenuation
@ -84,12 +88,14 @@ EXPORTS
sfSoundStream_SetPitch
sfSoundStream_SetVolume
sfSoundStream_SetPosition
sfSoundStream_SetRelativeToListener
sfSoundStream_SetMinDistance
sfSoundStream_SetAttenuation
sfSoundStream_SetLoop
sfSoundStream_GetPitch
sfSoundStream_GetVolume
sfSoundStream_GetPosition
sfSoundStream_IsRelativeToListener
sfSoundStream_GetMinDistance
sfSoundStream_GetAttenuation
sfSoundStream_GetLoop

View File

@ -21,11 +21,13 @@ EXPORTS
sfMusic_SetPitch
sfMusic_SetVolume
sfMusic_SetPosition
sfMusic_SetRelativeToListener
sfMusic_SetMinDistance
sfMusic_SetAttenuation
sfMusic_GetPitch
sfMusic_GetVolume
sfMusic_GetPosition
sfMusic_IsRelativeToListener
sfMusic_GetMinDistance
sfMusic_GetAttenuation
sfMusic_GetPlayingOffset
@ -42,12 +44,14 @@ EXPORTS
sfSound_SetPitch
sfSound_SetVolume
sfSound_SetPosition
sfSound_SetRelativeToListener
sfSound_SetMinDistance
sfSound_SetAttenuation
sfSound_SetPlayingOffset
sfSound_GetPitch
sfSound_GetVolume
sfSound_GetPosition
sfSound_IsRelativeToListener
sfSound_GetPlayingOffset
sfSound_GetMinDistance
sfSound_GetAttenuation
@ -84,12 +88,14 @@ EXPORTS
sfSoundStream_SetPitch
sfSoundStream_SetVolume
sfSoundStream_SetPosition
sfSoundStream_SetRelativeToListener
sfSoundStream_SetMinDistance
sfSoundStream_SetAttenuation
sfSoundStream_SetLoop
sfSoundStream_GetPitch
sfSoundStream_GetVolume
sfSoundStream_GetPosition
sfSoundStream_IsRelativeToListener
sfSoundStream_GetMinDistance
sfSoundStream_GetAttenuation
sfSoundStream_GetLoop

View File

@ -184,6 +184,17 @@ CSFML_API void sfMusic_SetVolume(sfMusic* Music, float Volume);
////////////////////////////////////////////////////////////
CSFML_API void sfMusic_SetPosition(sfMusic* Music, float X, float Y, float Z);
////////////////////////////////////////////////////////////
/// Make the music's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
///
/// \param Music : Music to modify
/// \param Relative : True to set the position relative, false to set it absolute
///
////////////////////////////////////////////////////////////
CSFML_API void sfMusic_SetRelativeToListener(sfMusic* Music, sfBool Relative);
////////////////////////////////////////////////////////////
/// Set the minimum distance - closer than this distance,
/// the listener will hear the music at its maximum volume.
@ -237,6 +248,17 @@ CSFML_API float sfMusic_GetVolume(sfMusic* Music);
////////////////////////////////////////////////////////////
CSFML_API void sfMusic_GetPosition(sfMusic* Music, float* X, float* Y, float* Z);
////////////////////////////////////////////////////////////
/// Tell if the music's position is relative to the listener's
/// position, or if it's absolute
///
/// \param Music : Music to check
///
/// \return sfTrue if the position is relative, sfFalse if it's absolute
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfMusic_IsRelativeToListener(sfMusic* Music);
////////////////////////////////////////////////////////////
/// Get the minimum distance of a music
///

View File

@ -150,6 +150,17 @@ CSFML_API void sfSound_SetVolume(sfSound* Sound, float Volume);
////////////////////////////////////////////////////////////
CSFML_API void sfSound_SetPosition(sfSound* Sound, float X, float Y, float Z);
////////////////////////////////////////////////////////////
/// Make the sound's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
///
/// \param Sound : Sound to modify
/// \param Relative : True to set the position relative, false to set it absolute
///
////////////////////////////////////////////////////////////
CSFML_API void sfSound_SetRelativeToListener(sfSound* Sound, sfBool Relative);
////////////////////////////////////////////////////////////
/// Set the minimum distance - closer than this distance,
/// the listener will hear the sound at its maximum volume.
@ -212,6 +223,17 @@ CSFML_API float sfSound_GetVolume(sfSound* Sound);
////////////////////////////////////////////////////////////
CSFML_API void sfSound_GetPosition(sfSound* Sound, float* X, float* Y, float* Z);
////////////////////////////////////////////////////////////
/// Tell if the sound's position is relative to the listener's
/// position, or if it's absolute
///
/// \param Sound : Sound to check
///
/// \return sfTrue if the position is relative, sfFalse if it's absolute
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfSound_IsRelativeToListener(sfSound* Sound);
////////////////////////////////////////////////////////////
/// Get the minimum distance of a sound
///

View File

@ -157,6 +157,17 @@ CSFML_API void sfSoundStream_SetVolume(sfSoundStream* SoundStream, float Volume)
////////////////////////////////////////////////////////////
CSFML_API void sfSoundStream_SetPosition(sfSoundStream* SoundStream, float X, float Y, float Z);
////////////////////////////////////////////////////////////
/// Make the sound stream's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
///
/// \param SoundStream : Sound stream to modify
/// \param Relative : True to set the position relative, false to set it absolute
///
////////////////////////////////////////////////////////////
CSFML_API void sfSoundStream_SetRelativeToListener(sfSoundStream* SoundStream, sfBool Relative);
////////////////////////////////////////////////////////////
/// Set the minimum distance - closer than this distance,
/// the listener will hear the sound stream at its maximum volume.
@ -219,6 +230,17 @@ CSFML_API float sfSoundStream_GetVolume(sfSoundStream* SoundStream);
////////////////////////////////////////////////////////////
CSFML_API void sfSoundStream_GetPosition(sfSoundStream* SoundStream, float* X, float* Y, float* Z);
////////////////////////////////////////////////////////////
/// Tell if the sound stream's position is relative to the listener's
/// position, or if it's absolute
///
/// \param SoundStream : Sound stream to check
///
/// \return sfTrue if the position is relative, sfFalse if it's absolute
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfSoundStream_IsRelativeToListener(sfSoundStream* SoundStream);
////////////////////////////////////////////////////////////
/// Get the minimum distance of a sound stream
///

View File

@ -198,6 +198,17 @@ void sfMusic_SetPosition(sfMusic* Music, float X, float Y, float Z)
}
////////////////////////////////////////////////////////////
/// Make the music's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
////////////////////////////////////////////////////////////
void sfMusic_SetRelativeToListener(sfMusic* music, sfBool Relative)
{
CSFML_CALL(music, SetRelativeToListener(Relative == sfTrue));
}
////////////////////////////////////////////////////////////
/// Set the minimum distance - closer than this distance,
/// the listener will hear the music at its maximum volume.
@ -255,6 +266,16 @@ void sfMusic_GetPosition(sfMusic* Music, float* X, float* Y, float* Z)
}
////////////////////////////////////////////////////////////
/// Tell if the music's position is relative to the listener's
/// position, or if it's absolute
////////////////////////////////////////////////////////////
CSFML_API sfBool sfMusic_IsRelativeToListener(sfMusic* Music)
{
CSFML_CALL_RETURN(Music, IsRelativeToListener(), sfFalse);
}
////////////////////////////////////////////////////////////
/// Get the minimum distance of a music
////////////////////////////////////////////////////////////

View File

@ -168,6 +168,17 @@ void sfSound_SetPosition(sfSound* Sound, float X, float Y, float Z)
}
////////////////////////////////////////////////////////////
/// Make the sound's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
////////////////////////////////////////////////////////////
void sfSound_SetRelativeToListener(sfSound* Sound, sfBool Relative)
{
CSFML_CALL(Sound, SetRelativeToListener(Relative == sfTrue));
}
////////////////////////////////////////////////////////////
/// Set the minimum distance - closer than this distance,
/// the listener will hear the sound at its maximum volume.
@ -231,6 +242,16 @@ void sfSound_GetPosition(sfSound* Sound, float* X, float* Y, float* Z)
}
////////////////////////////////////////////////////////////
/// Tell if the sound's position is relative to the listener's
/// position, or if it's absolute
////////////////////////////////////////////////////////////
CSFML_API sfBool sfSound_IsRelativeToListener(sfSound* Sound)
{
CSFML_CALL_RETURN(Sound, IsRelativeToListener(), sfFalse);
}
////////////////////////////////////////////////////////////
/// Get the minimum distance of a sound
////////////////////////////////////////////////////////////

View File

@ -195,6 +195,17 @@ void sfSoundStream_SetPosition(sfSoundStream* SoundStream, float X, float Y, flo
}
////////////////////////////////////////////////////////////
/// Make the sound stream's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
////////////////////////////////////////////////////////////
void sfSoundStream_SetRelativeToListener(sfSoundStream* SoundStream, sfBool Relative)
{
CSFML_CALL(SoundStream, SetRelativeToListener(Relative == sfTrue));
}
////////////////////////////////////////////////////////////
/// Set the minimum distance - closer than this distance,
/// the listener will hear the sound stream at its maximum volume.
@ -258,6 +269,16 @@ void sfSoundStream_GetPosition(sfSoundStream* SoundStream, float* X, float* Y, f
}
////////////////////////////////////////////////////////////
/// Tell if the sound stream's position is relative to the listener's
/// position, or if it's absolute
////////////////////////////////////////////////////////////
CSFML_API sfBool sfSoundStream_IsRelativeToListener(sfSoundStream* SoundStream)
{
CSFML_CALL_RETURN(SoundStream, IsRelativeToListener(), sfFalse);
}
////////////////////////////////////////////////////////////
/// Get the minimum distance of a sound stream
////////////////////////////////////////////////////////////

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]

View File

@ -159,6 +159,16 @@ public :
////////////////////////////////////////////////////////////
void SetPosition(const Vector3f& Position);
////////////////////////////////////////////////////////////
/// Make the sound's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
///
/// \param Relative : True to set the position relative, false to set it absolute
///
////////////////////////////////////////////////////////////
void SetRelativeToListener(bool Relative);
////////////////////////////////////////////////////////////
/// Set the minimum distance - closer than this distance,
/// the listener will hear the sound at its maximum volume.
@ -227,6 +237,15 @@ public :
////////////////////////////////////////////////////////////
Vector3f GetPosition() const;
////////////////////////////////////////////////////////////
/// Tell if the sound's position is relative to the listener's
/// position, or if it's absolute
///
/// \return True if the position is relative, false if it's absolute
///
////////////////////////////////////////////////////////////
bool IsRelativeToListener() const;
////////////////////////////////////////////////////////////
/// Get the minimum distance
///

View File

@ -53,11 +53,13 @@ public :
using Sound::SetPitch;
using Sound::SetVolume;
using Sound::SetPosition;
using Sound::SetRelativeToListener;
using Sound::SetMinDistance;
using Sound::SetAttenuation;
using Sound::GetPitch;
using Sound::GetVolume;
using Sound::GetPosition;
using Sound::IsRelativeToListener;
using Sound::GetMinDistance;
using Sound::GetAttenuation;

View File

@ -175,6 +175,17 @@ void Sound::SetPosition(const Vector3f& Position)
}
////////////////////////////////////////////////////////////
/// Make the sound's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
////////////////////////////////////////////////////////////
void Sound::SetRelativeToListener(bool Relative)
{
ALCheck(alSourcei(mySource, AL_SOURCE_RELATIVE, Relative));
}
////////////////////////////////////////////////////////////
/// Set the minimum distance - closer than this distance,
/// the listener will hear the sound at its maximum volume.
@ -263,6 +274,19 @@ Vector3f Sound::GetPosition() const
}
////////////////////////////////////////////////////////////
/// Tell if the sound's position is relative to the listener's
/// position, or if it's absolute
////////////////////////////////////////////////////////////
bool Sound::IsRelativeToListener() const
{
ALint Relative;
ALCheck(alGetSourcei(mySource, AL_SOURCE_RELATIVE, &Relative));
return Relative != 0;
}
////////////////////////////////////////////////////////////
/// Get the minimum distance
////////////////////////////////////////////////////////////