Process a new chunk of recorded samples.
Start capturing audio data.
Stop capturing audio data.
Start the capture. 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.
Stop the capture.
Get the sample rate in samples per second.
Check if the system supports audio capture.
Abstract base class for capturing sound data.
SoundBuffer provides a simple interface to access the audio recording capabilities of the computer (the microphone).
As an abstract base class, it only cares about capturing sound samples, the task of making something useful with them is left to the derived class. Note that SFML provides a built-in specialization for saving the captured data to a sound buffer (see SoundBufferRecorder).
A derived class has only one virtual function to override:
onProcessSamples provides the new chunks of audio samples while the capture happens
Moreover, two additionnal virtual functions can be overriden as well if necessary:
onStart is called before the capture happens, to perform custom initializations onStop is called after the capture ends, to perform custom cleanup
The audio capture feature may not be supported or activated on every platform, thus it is recommended to check its availability with the isAvailable() function. If it returns false, then any attempt to use an audio recorder will fail.
It is important to note that the audio capture happens in a separate thread, so that it doesn't block the rest of the program. In particular, the onProcessSamples and onStop virtual functions (but not onStart) will be called from this separate thread. It is important to keep this in mind, because you may have to take care of synchronization issues if you share data between threads.