SoundRecorder.h File Reference

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

Go to the source code of this file.


Typedefs

typedef sfBool(* sfSoundRecorderStartCallback )(void *)
 Type of the callback used when starting a capture.
typedef sfBool(* sfSoundRecorderProcessCallback )(const sfInt16 *, size_t, void *)
 Type of the callback used to process audio data.
typedef void(* sfSoundRecorderStopCallback )(void *)
 Type of the callback used when stopping a capture.

Functions

CSFML_API sfSoundRecordersfSoundRecorder_Create (sfSoundRecorderStartCallback OnStart, sfSoundRecorderProcessCallback OnProcess, sfSoundRecorderStopCallback OnStop, void *UserData)
 Construct a new sound recorder with callback functions for processing captured samples.
CSFML_API void sfSoundRecorder_Destroy (sfSoundRecorder *SoundRecorder)
 Destroy an existing sound recorder.
CSFML_API void sfSoundRecorder_Start (sfSoundRecorder *SoundRecorder, unsigned int SampleRate)
 Start the capture.
CSFML_API void sfSoundRecorder_Stop (sfSoundRecorder *SoundRecorder)
 Stop the capture.
CSFML_API unsigned int sfSoundRecorder_GetSampleRate (sfSoundRecorder *SoundRecorder)
 Get the sample rate of a sound recorder.
CSFML_API sfBool sfSoundRecorder_CanCapture ()
 Tell if the system supports sound capture.

Typedef Documentation

typedef sfBool(* sfSoundRecorderProcessCallback)(const sfInt16 *, size_t, void *)

Type of the callback used to process audio data.

Definition at line 36 of file SoundRecorder.h.

Type of the callback used when starting a capture.

Definition at line 35 of file SoundRecorder.h.

typedef void(* sfSoundRecorderStopCallback)(void *)

Type of the callback used when stopping a capture.

Definition at line 37 of file SoundRecorder.h.


Function Documentation

CSFML_API sfBool sfSoundRecorder_CanCapture (  ) 

Tell if the system supports sound capture.

If not, this class won't be usable

Returns:
sfTrue if audio capture is supported

CSFML_API sfSoundRecorder* sfSoundRecorder_Create ( sfSoundRecorderStartCallback  OnStart,
sfSoundRecorderProcessCallback  OnProcess,
sfSoundRecorderStopCallback  OnStop,
void *  UserData 
)

Construct a new sound recorder with callback functions for processing captured samples.

Parameters:
OnStart : Callback function which will be called when a new capture starts (can be NULL)
OnProcess : Callback function which will be called each time there's audio data to process
OnStop : Callback function which will be called when the current capture stops (can be NULL)
UserData : Data to pass to the callback function (can be NULL)
Returns:
A new sfSoundRecorder object (NULL if failed)

CSFML_API void sfSoundRecorder_Destroy ( sfSoundRecorder SoundRecorder  ) 

Destroy an existing sound recorder.

Parameters:
SoundRecorder : Sound recorder to delete

CSFML_API unsigned int sfSoundRecorder_GetSampleRate ( sfSoundRecorder SoundRecorder  ) 

Get the sample rate of a sound recorder.

Parameters:
SoundRecorder : Sound recorder to get sample rate from
Returns:
Frequency, in samples per second

CSFML_API void sfSoundRecorder_Start ( sfSoundRecorder SoundRecorder,
unsigned int  SampleRate 
)

Start the capture.

Warning : only one capture can happen at the same time

Parameters:
SoundRecorder : Sound recorder to start
SampleRate : Sound frequency (the more samples, the higher the quality)

CSFML_API void sfSoundRecorder_Stop ( sfSoundRecorder SoundRecorder  ) 

Stop the capture.

Parameters:
SoundRecorder : Sound recorder to stop