SoundStream.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.


Data Structures

struct  sfSoundStreamChunk
 sfSoundStreamChunk defines the data to fill by the OnGetData callback More...

Typedefs

typedef sfBool(* sfSoundStreamStartCallback )(void *)
 Type of the callback used to start a sound stream.
typedef sfBool(* sfSoundStreamGetDataCallback )(sfSoundStreamChunk *, void *)
 Type of the callback used to get a sound stream data.

Functions

CSFML_API sfSoundStreamsfSoundStream_Create (sfSoundStreamStartCallback OnStart, sfSoundStreamGetDataCallback OnGetData, unsigned int ChannelsCount, unsigned int SampleRate, void *UserData)
 Construct a new sound stream.
CSFML_API void sfSoundStream_Destroy (sfSoundStream *SoundStreamStream)
 Destroy an existing sound stream.
CSFML_API void sfSoundStream_Play (sfSoundStream *SoundStream)
 Start playing a sound stream.
CSFML_API void sfSoundStream_Pause (sfSoundStream *SoundStream)
 Pause a sound stream.
CSFML_API void sfSoundStream_Stop (sfSoundStream *SoundStream)
 Stop playing a sound stream.
CSFML_API sfSoundStatus sfSoundStream_GetStatus (sfSoundStream *SoundStream)
 Get the status of a sound stream (stopped, paused, playing).
CSFML_API unsigned int sfSoundStream_GetChannelsCount (sfSoundStream *SoundStream)
 Return the number of channels of a sound stream (1 = mono, 2 = stereo).
CSFML_API unsigned int sfSoundStream_GetSampleRate (sfSoundStream *SoundStream)
 Get the sample rate of a sound stream.
CSFML_API void sfSoundStream_SetPitch (sfSoundStream *SoundStream, float Pitch)
 Set the pitch of a sound stream.
CSFML_API void sfSoundStream_SetVolume (sfSoundStream *SoundStream, float Volume)
 Set the volume of a sound stream.
CSFML_API void sfSoundStream_SetPosition (sfSoundStream *SoundStream, float X, float Y, float Z)
 Set the position of a sound stream.
CSFML_API void sfSoundStream_SetRelativeToListener (sfSoundStream *SoundStream, sfBool Relative)
 Make the sound stream's position relative to the listener's position, or absolute.
CSFML_API void sfSoundStream_SetMinDistance (sfSoundStream *SoundStream, float MinDistance)
 Set the minimum distance - closer than this distance, the listener will hear the sound stream at its maximum volume.
CSFML_API void sfSoundStream_SetAttenuation (sfSoundStream *SoundStream, float Attenuation)
 Set the attenuation factor - the higher the attenuation, the more the sound stream will be attenuated with distance from listener.
CSFML_API void sfSoundStream_SetLoop (sfSoundStream *SoundStream, sfBool Loop)
 Set a stream loop state.
CSFML_API float sfSoundStream_GetPitch (sfSoundStream *SoundStream)
 Get the pitch of a sound stream.
CSFML_API float sfSoundStream_GetVolume (sfSoundStream *SoundStream)
 Get the volume of a sound stream.
CSFML_API void sfSoundStream_GetPosition (sfSoundStream *SoundStream, float *X, float *Y, float *Z)
 Get the position of a sound stream.
CSFML_API sfBool sfSoundStream_IsRelativeToListener (sfSoundStream *SoundStream)
 Tell if the sound stream's position is relative to the listener's position, or if it's absolute.
CSFML_API float sfSoundStream_GetMinDistance (sfSoundStream *SoundStream)
 Get the minimum distance of a sound stream.
CSFML_API float sfSoundStream_GetAttenuation (sfSoundStream *SoundStream)
 Get the attenuation factor of a sound stream.
CSFML_API sfBool sfSoundStream_GetLoop (sfSoundStream *SoundStream)
 Tell whether or not a stream is looping.
CSFML_API float sfSoundStream_GetPlayingOffset (sfSoundStream *SoundStream)
 Get the current playing position of a sound stream.

Typedef Documentation

Type of the callback used to get a sound stream data.

Definition at line 47 of file SoundStream.h.

typedef sfBool(* sfSoundStreamStartCallback)(void *)

Type of the callback used to start a sound stream.

Definition at line 46 of file SoundStream.h.


Function Documentation

CSFML_API sfSoundStream* sfSoundStream_Create ( sfSoundStreamStartCallback  OnStart,
sfSoundStreamGetDataCallback  OnGetData,
unsigned int  ChannelsCount,
unsigned int  SampleRate,
void *  UserData 
)

Construct a new sound stream.

Parameters:
OnStart : Function called when the stream starts (can be NULL)
OnGetData : Function called when the stream needs more data (can't be NULL)
ChannelsCount : Number of channels to use (1 = mono, 2 = stereo)
SampleRate : Sample rate of the sound (44100 = CD quality)
UserData : Data to pass to the callback functions
Returns:
A new sfSoundStream object (NULL if failed)

CSFML_API void sfSoundStream_Destroy ( sfSoundStream SoundStreamStream  ) 

Destroy an existing sound stream.

Parameters:
SoundStream : Sound stream to delete

CSFML_API float sfSoundStream_GetAttenuation ( sfSoundStream SoundStream  ) 

Get the attenuation factor of a sound stream.

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

CSFML_API unsigned int sfSoundStream_GetChannelsCount ( sfSoundStream SoundStream  ) 

Return the number of channels of a sound stream (1 = mono, 2 = stereo).

Parameters:
SoundStream : Sound stream to get the channels count from
Returns:
Number of channels

CSFML_API sfBool sfSoundStream_GetLoop ( sfSoundStream SoundStream  ) 

Tell whether or not a stream is looping.

Parameters:
SoundStream : Soundstream to get the loop state from
Returns:
sfTrue if the stream is looping, sfFalse otherwise

CSFML_API float sfSoundStream_GetMinDistance ( sfSoundStream SoundStream  ) 

Get the minimum distance of a sound stream.

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

CSFML_API float sfSoundStream_GetPitch ( sfSoundStream SoundStream  ) 

Get the pitch of a sound stream.

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

CSFML_API float sfSoundStream_GetPlayingOffset ( sfSoundStream SoundStream  ) 

Get the current playing position of a sound stream.

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

CSFML_API void sfSoundStream_GetPosition ( sfSoundStream SoundStream,
float *  X,
float *  Y,
float *  Z 
)

Get the position of a sound stream.

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

CSFML_API unsigned int sfSoundStream_GetSampleRate ( sfSoundStream SoundStream  ) 

Get the sample rate of a sound stream.

Parameters:
SoundStream : Sound stream to get the sample rate from
Returns:
Stream frequency (number of samples per second)

CSFML_API sfSoundStatus sfSoundStream_GetStatus ( sfSoundStream SoundStream  ) 

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

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

CSFML_API float sfSoundStream_GetVolume ( sfSoundStream SoundStream  ) 

Get the volume of a sound stream.

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

CSFML_API sfBool sfSoundStream_IsRelativeToListener ( sfSoundStream SoundStream  ) 

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

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

CSFML_API void sfSoundStream_Pause ( sfSoundStream SoundStream  ) 

Pause a sound stream.

Parameters:
SoundStream : Sound stream to pause

CSFML_API void sfSoundStream_Play ( sfSoundStream SoundStream  ) 

Start playing a sound stream.

Parameters:
SoundStream : Sound stream to play

CSFML_API void sfSoundStream_SetAttenuation ( sfSoundStream SoundStream,
float  Attenuation 
)

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

The default attenuation factor 1.0

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

CSFML_API void sfSoundStream_SetLoop ( sfSoundStream SoundStream,
sfBool  Loop 
)

Set a stream loop state.

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

CSFML_API void sfSoundStream_SetMinDistance ( sfSoundStream SoundStream,
float  MinDistance 
)

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

The default minimum distance is 1.0

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

CSFML_API void sfSoundStream_SetPitch ( sfSoundStream SoundStream,
float  Pitch 
)

Set the pitch of a sound stream.

Parameters:
SoundStream : Sound stream to modify
Pitch : New pitch

CSFML_API void sfSoundStream_SetPosition ( sfSoundStream SoundStream,
float  X,
float  Y,
float  Z 
)

Set the position of a sound stream.

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

CSFML_API void sfSoundStream_SetRelativeToListener ( sfSoundStream SoundStream,
sfBool  Relative 
)

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

The default value is false (absolute)

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

CSFML_API void sfSoundStream_SetVolume ( sfSoundStream SoundStream,
float  Volume 
)

Set the volume of a sound stream.

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

CSFML_API void sfSoundStream_Stop ( sfSoundStream SoundStream  ) 

Stop playing a sound stream.

Parameters:
SoundStream : Sound stream to stop