SoundStream.h File Reference

#include <SFML/Config.h>
#include <SFML/Audio/SoundStatus.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 sfSoundStream sfSoundStream
 sfSoundStream is a streamed sound, ie samples are acquired while the sound is playing.
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_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 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 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.

Typedef Documentation

typedef struct sfSoundStream sfSoundStream

sfSoundStream is a streamed sound, ie samples are acquired while the sound is playing.

Use it for big sound that would require hundreds of MB in memory (see sfMusic), or for streaming sound from the network

Definition at line 41 of file SoundStream.h.

typedef sfBool(*) sfSoundStreamGetDataCallback(sfSoundStreamChunk *, void *)

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

Definition at line 54 of file SoundStream.h.

typedef sfBool(*) sfSoundStreamStartCallback(void *)

Type of the callback used to start a sound stream.

Definition at line 53 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 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 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 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_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_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