Sound.h File Reference

#include <SFML/Config.h>
#include <SFML/Audio/SoundStatus.h>
#include <SFML/Audio/Types.h>

Go to the source code of this file.


Functions

CSFML_API sfSoundsfSound_Create ()
 Construct a new sound.
CSFML_API void sfSound_Destroy (sfSound *Sound)
 Destroy an existing sound.
CSFML_API void sfSound_Play (sfSound *Sound)
 Start playing a sound.
CSFML_API void sfSound_Pause (sfSound *Sound)
 Pause a sound.
CSFML_API void sfSound_Stop (sfSound *Sound)
 Stop playing a sound.
CSFML_API void sfSound_SetBuffer (sfSound *Sound, sfSoundBuffer *Buffer)
 Bind a sound buffer to a sound.
CSFML_API sfSoundBuffersfSound_GetBuffer (sfSound *Sound)
 Get the sound buffer bound to a sound.
CSFML_API void sfSound_SetLoop (sfSound *Sound, sfBool Loop)
 Set a sound loop state.
CSFML_API sfBool sfSound_GetLoop (sfSound *Sound)
 Tell whether or not a sound is looping.
CSFML_API sfSoundStatus sfSound_GetStatus (sfSound *Sound)
 Get the status of a sound (stopped, paused, playing).
CSFML_API void sfSound_SetPitch (sfSound *Sound, float Pitch)
 Set the pitch of a sound.
CSFML_API void sfSound_SetVolume (sfSound *Sound, float Volume)
 Set the volume of a sound.
CSFML_API void sfSound_SetPosition (sfSound *Sound, float X, float Y, float Z)
 Set the position of a sound.
CSFML_API void sfSound_SetRelativeToListener (sfSound *Sound, sfBool Relative)
 Make the sound's position relative to the listener's position, or absolute.
CSFML_API void sfSound_SetMinDistance (sfSound *Sound, float MinDistance)
 Set the minimum distance - closer than this distance, the listener will hear the sound at its maximum volume.
CSFML_API void sfSound_SetAttenuation (sfSound *Sound, float Attenuation)
 Set the attenuation factor - the higher the attenuation, the more the sound will be attenuated with distance from listener.
CSFML_API void sfSound_SetPlayingOffset (sfSound *Sound, float TimeOffset)
 Set the current playing position of a sound.
CSFML_API float sfSound_GetPitch (sfSound *Sound)
 Get the pitch of a sound.
CSFML_API float sfSound_GetVolume (sfSound *Sound)
 Get the volume of a sound.
CSFML_API void sfSound_GetPosition (sfSound *Sound, float *X, float *Y, float *Z)
 Get the position of a sound.
CSFML_API sfBool sfSound_IsRelativeToListener (sfSound *Sound)
 Tell if the sound's position is relative to the listener's position, or if it's absolute.
CSFML_API float sfSound_GetMinDistance (sfSound *Sound)
 Get the minimum distance of a sound.
CSFML_API float sfSound_GetAttenuation (sfSound *Sound)
 Get the attenuation factor of a sound.
CSFML_API float sfSound_GetPlayingOffset (sfSound *Sound)
 Get the current playing position of a sound.

Function Documentation

CSFML_API sfSound* sfSound_Create (  ) 

Construct a new sound.

Returns:
A new sfSound object (NULL if failed)

CSFML_API void sfSound_Destroy ( sfSound Sound  ) 

Destroy an existing sound.

Parameters:
Sound : Sound to delete

CSFML_API float sfSound_GetAttenuation ( sfSound Sound  ) 

Get the attenuation factor of a sound.

Parameters:
Sound : Sound to get the attenuation factor from
Returns:
Attenuation factor for the sound

CSFML_API sfSoundBuffer* sfSound_GetBuffer ( sfSound Sound  ) 

Get the sound buffer bound to a sound.

Parameters:
Sound : Sound to get the buffer from
Returns:
Pointer to the sound's buffer

CSFML_API sfBool sfSound_GetLoop ( sfSound Sound  ) 

Tell whether or not a sound is looping.

Parameters:
Sound : Sound to get the loop state from
Returns:
sfTrue if the sound is looping, sfFalse otherwise

CSFML_API float sfSound_GetMinDistance ( sfSound Sound  ) 

Get the minimum distance of a sound.

Parameters:
Sound : Sound to get the minimum distance from
Returns:
Minimum distance for the sound

CSFML_API float sfSound_GetPitch ( sfSound Sound  ) 

Get the pitch of a sound.

Parameters:
Sound : Sound to get the pitch from
Returns:
Pitch value

CSFML_API float sfSound_GetPlayingOffset ( sfSound Sound  ) 

Get the current playing position of a sound.

Parameters:
Sound : Sound to get the position from
Returns:
Current playing position, expressed in seconds

CSFML_API void sfSound_GetPosition ( sfSound Sound,
float *  X,
float *  Y,
float *  Z 
)

Get the position of a sound.

Parameters:
Sound : Sound to get the position from
X : X position of the sound in the world
Y : Y position of the sound in the world
Z : Z position of the sound in the world

CSFML_API sfSoundStatus sfSound_GetStatus ( sfSound Sound  ) 

Get the status of a sound (stopped, paused, playing).

Parameters:
Sound : Sound to get the status from
Returns:
Current status of the sound

CSFML_API float sfSound_GetVolume ( sfSound Sound  ) 

Get the volume of a sound.

Parameters:
Sound : Sound to get the volume from
Returns:
Volume value (in range [1, 100])

CSFML_API sfBool sfSound_IsRelativeToListener ( sfSound Sound  ) 

Tell if the sound's position is relative to the listener's position, or if it's absolute.

Parameters:
Sound : Sound to check
Returns:
sfTrue if the position is relative, sfFalse if it's absolute

CSFML_API void sfSound_Pause ( sfSound Sound  ) 

Pause a sound.

Parameters:
Sound : Sound to pause

CSFML_API void sfSound_Play ( sfSound Sound  ) 

Start playing a sound.

Parameters:
Sound : Sound to play

CSFML_API void sfSound_SetAttenuation ( sfSound Sound,
float  Attenuation 
)

Set the attenuation factor - the higher the attenuation, the more the sound will be attenuated with distance from listener.

The default attenuation factor is 1.0

Parameters:
Sound : Sound to modify
Attenuation : New attenuation factor for the sound

CSFML_API void sfSound_SetBuffer ( sfSound Sound,
sfSoundBuffer Buffer 
)

Bind a sound buffer to a sound.

Parameters:
Sound : Sound to set the loop state
Buffer : Buffer to bind

CSFML_API void sfSound_SetLoop ( sfSound Sound,
sfBool  Loop 
)

Set a sound loop state.

Parameters:
Sound : Sound to set the loop state
Loop : sfTrue to play in loop, sfFalse to play once

CSFML_API void sfSound_SetMinDistance ( sfSound Sound,
float  MinDistance 
)

Set the minimum distance - closer than this distance, the listener will hear the sound at its maximum volume.

The default minimum distance is 1.0

Parameters:
Sound : Sound to modify
MinDistance : New minimum distance for the sound

CSFML_API void sfSound_SetPitch ( sfSound Sound,
float  Pitch 
)

Set the pitch of a sound.

Parameters:
Sound : Sound to modify
Pitch : New pitch

CSFML_API void sfSound_SetPlayingOffset ( sfSound Sound,
float  TimeOffset 
)

Set the current playing position of a sound.

Parameters:
Sound : Sound to modify
TimeOffset : New playing position, expressed in seconds

CSFML_API void sfSound_SetPosition ( sfSound Sound,
float  X,
float  Y,
float  Z 
)

Set the position of a sound.

Parameters:
Sound : Sound to modify
X : X position of the sound in the world
Y : Y position of the sound in the world
Z : Z position of the sound in the world

CSFML_API void sfSound_SetRelativeToListener ( sfSound Sound,
sfBool  Relative 
)

Make the sound's position relative to the listener's position, or absolute.

The default value is false (absolute)

Parameters:
Sound : Sound to modify
Relative : True to set the position relative, false to set it absolute

CSFML_API void sfSound_SetVolume ( sfSound Sound,
float  Volume 
)

Set the volume of a sound.

Parameters:
Sound : Sound to modify
Volume : Volume (in range [0, 100])

CSFML_API void sfSound_Stop ( sfSound Sound  ) 

Stop playing a sound.

Parameters:
Sound : Sound to stop