CSFML 3.0.0
Loading...
Searching...
No Matches
Functions
SoundBufferRecorder.h File Reference
`#include <CSFML/Audio/Export.h>`
`#include <CSFML/Audio/Types.h>`

Go to the source code of this file.

## Functions
sfSoundBufferRecorder * | sfSoundBufferRecorder_create (void)
| Create a new sound buffer recorder.
void | sfSoundBufferRecorder_destroy (const sfSoundBufferRecorder *soundBufferRecorder)
| Destroy a sound buffer recorder.
bool | sfSoundBufferRecorder_start (sfSoundBufferRecorder *soundBufferRecorder, unsigned int sampleRate)
| Start the capture of a sound recorder recorder.
void | sfSoundBufferRecorder_stop (sfSoundBufferRecorder *soundBufferRecorder)
| Stop the capture of a sound recorder.
unsigned int | sfSoundBufferRecorder_getSampleRate (const sfSoundBufferRecorder *soundBufferRecorder)
| Get the sample rate of a sound buffer recorder.
const sfSoundBuffer * | sfSoundBufferRecorder_getBuffer (const sfSoundBufferRecorder *soundBufferRecorder)
| Get the sound buffer containing the captured audio data.
bool | sfSoundBufferRecorder_setDevice (sfSoundBufferRecorder *soundBufferRecorder, const char *name)
| Set the audio capture device.
const char * | sfSoundBufferRecorder_getDevice (sfSoundBufferRecorder *soundBufferRecorder)
| Get the name of the current audio capture device.
void | sfSoundBufferRecorder_setChannelCount (sfSoundBufferRecorder *soundBufferRecorder, unsigned int channelCount)
| Set the channel count of the audio capture device.
unsigned int | sfSoundBufferRecorder_getChannelCount (const sfSoundBufferRecorder *soundBufferRecorder)
| Get the number of channels used by this recorder.

## Function Documentation

## ◆ sfSoundBufferRecorder_create()

sfSoundBufferRecorder * sfSoundBufferRecorder_create | ( | void |  | ) |

Create a new sound buffer recorder.

Returns
  A new sfSoundBufferRecorder object (NULL if failed)

## ◆ sfSoundBufferRecorder_destroy()

void sfSoundBufferRecorder_destroy | ( | const sfSoundBufferRecorder * | soundBufferRecorder | ) |

Destroy a sound buffer recorder.

Parameters

  soundBufferRecorder | Sound buffer recorder to destroy

## ◆ sfSoundBufferRecorder_getBuffer()

const sfSoundBuffer * sfSoundBufferRecorder_getBuffer | ( | const sfSoundBufferRecorder * | soundBufferRecorder | ) |

Get the sound buffer containing the captured audio data.

The sound buffer is valid only after the capture has ended. This function provides a read-only access to the internal sound buffer, but it can be copied if you need to make any modification to it.

Parameters

  soundBufferRecorder | Sound buffer recorder object

Returns
  Read-only access to the sound buffer

## ◆ sfSoundBufferRecorder_getChannelCount()

unsigned int sfSoundBufferRecorder_getChannelCount | ( | const sfSoundBufferRecorder * | soundBufferRecorder | ) |

Get the number of channels used by this recorder.

Currently only mono and stereo are supported, so the value is either 1 (for mono) or 2 (for stereo).

Parameters

  soundBufferRecorder | Sound buffer recorder object

Returns
  Number of channels

See also
  sfSoundBufferRecorder_setChannelCount

## ◆ sfSoundBufferRecorder_getDevice()

const char * sfSoundBufferRecorder_getDevice | ( | sfSoundBufferRecorder * | soundBufferRecorder | ) |

Get the name of the current audio capture device.

Parameters

  soundBufferRecorder | Sound buffer recorder object

Returns
  The name of the current audio capture device

## ◆ sfSoundBufferRecorder_getSampleRate()

unsigned int sfSoundBufferRecorder_getSampleRate | ( | const sfSoundBufferRecorder * | soundBufferRecorder | ) |

Get the sample rate of a sound buffer 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

  soundBufferRecorder | Sound buffer recorder object

Returns
  Sample rate, in samples per second

## ◆ sfSoundBufferRecorder_setChannelCount()

void sfSoundBufferRecorder_setChannelCount | ( | sfSoundBufferRecorder * | soundBufferRecorder,
|  | unsigned int | channelCount )

Set the channel count of the audio capture device.

This method allows you to specify the number of channels used for recording. Currently only 16-bit mono and 16-bit stereo are supported.

Parameters

  soundBufferRecorder | Sound buffer recorder object
  channelCount | Number of channels. Currently only mono (1) and stereo (2) are supported.

See also
  sfSoundBufferRecorder_getChannelCount

## ◆ sfSoundBufferRecorder_setDevice()

bool sfSoundBufferRecorder_setDevice | ( | sfSoundBufferRecorder * | soundBufferRecorder,
|  | const char * | name )

Set the audio capture device.

This function sets the audio capture device to the device with the given name. It can be called on the fly (i.e: while recording). If you do so while recording and opening the device fails, it stops the recording.

Parameters

  soundBufferRecorder | Sound buffer recorder object
  name | The name of the audio capture device

Returns
  true, if it was able to set the requested device

## ◆ sfSoundBufferRecorder_start()

bool sfSoundBufferRecorder_start | ( | sfSoundBufferRecorder * | soundBufferRecorder,
|  | unsigned int | sampleRate )

Start the capture of a sound recorder 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

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

Returns
  true, if it was able to start recording

## ◆ sfSoundBufferRecorder_stop()

void sfSoundBufferRecorder_stop | ( | sfSoundBufferRecorder * | soundBufferRecorder | ) |

Stop the capture of a sound recorder.

Parameters

  soundBufferRecorder | Sound buffer recorder object