CSFML

- Main Page
- Data Structures
- Files

- File List
- Globals

Typedefs | Functions
SoundRecorder.h File Reference
`#include <SFML/Audio/Export.h>`
`#include <SFML/Audio/Types.h>`
`#include <stddef.h>`

Go to the source code of this file.

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

## Functions
CSFML_AUDIO_API sfSoundRecorder * | sfSoundRecorder_create (sfSoundRecorderStartCallback onStart, sfSoundRecorderProcessCallback onProcess, sfSoundRecorderStopCallback onStop, void *userData)
| Construct a new sound recorder from callback functions. More...
CSFML_AUDIO_API void | sfSoundRecorder_destroy (sfSoundRecorder *soundRecorder)
| Destroy a sound recorder. More...
CSFML_AUDIO_API void | sfSoundRecorder_start (sfSoundRecorder *soundRecorder, unsigned int sampleRate)
| Start the capture of a sound recorder. More...
CSFML_AUDIO_API void | sfSoundRecorder_stop (sfSoundRecorder *soundRecorder)
| Stop the capture of a sound recorder. More...
CSFML_AUDIO_API unsigned int | sfSoundRecorder_getSampleRate (const sfSoundRecorder *soundRecorder)
| Get the sample rate of a sound recorder. More...
CSFML_AUDIO_API sfBool | sfSoundRecorder_isAvailable (void)
| Check if the system supports audio capture. More...

## Typedef Documentation

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

Type of the callback used to process audio data.

Definition at line 37 of file SoundRecorder.h.

typedef sfBool(* sfSoundRecorderStartCallback)(void *)

Type of the callback used when starting a capture.

Definition at line 36 of file SoundRecorder.h.

typedef void(* sfSoundRecorderStopCallback)(void *)

Type of the callback used when stopping a capture.

Definition at line 38 of file SoundRecorder.h.

## Function Documentation

CSFML_AUDIO_API sfSoundRecorder* sfSoundRecorder_create | ( | sfSoundRecorderStartCallback | onStart,
|  | sfSoundRecorderProcessCallback | onProcess,
|  | sfSoundRecorderStopCallback | onStop,
|  | void * | userData
| ) |  |

Construct a new sound recorder from callback functions.

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_AUDIO_API void sfSoundRecorder_destroy | ( | sfSoundRecorder * | soundRecorder) |  |

Destroy a sound recorder.

Parameters

  soundRecorder | Sound recorder to destroy

CSFML_AUDIO_API unsigned int sfSoundRecorder_getSampleRate | ( | const sfSoundRecorder * | soundRecorder) |  |

Get the sample rate of a sound recorder.

The sample rate defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality).

Parameters

  soundRecorder | Sound recorder object

Returns
  Sample rate, in samples per second

CSFML_AUDIO_API sfBool sfSoundRecorder_isAvailable | ( | void | ) |  |

Check if the system supports audio capture.

This function should always be called before using the audio capture features. If it returns false, then any attempt to use sfSoundRecorder will fail.

Returns
  sfTrue if audio capture is supported, sfFalse otherwise

CSFML_AUDIO_API void sfSoundRecorder_start | ( | sfSoundRecorder * | soundRecorder,
|  | unsigned int | sampleRate
| ) |  |

Start the capture of a sound recorder.

The sampleRate parameter defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality). This function uses its own thread so that it doesn't block the rest of the program while the capture runs. Please note that only one capture can happen at the same time.

Parameters

  soundRecorder | Sound recorder object
  sampleRate | Desired capture rate, in number of samples per second

CSFML_AUDIO_API void sfSoundRecorder_stop | ( | sfSoundRecorder * | soundRecorder) |  |

Stop the capture of a sound recorder.

Parameters

  soundRecorder | Sound recorder object