|
SFML
Simple and Fast Multimedia Library
|
Specialized SoundRecorder which stores the captured audio data into a sound buffer. More...
#include <SoundBufferRecorder.hpp>
Public Member Functions | |
| ~SoundBufferRecorder () override | |
| destructor | |
| const SoundBuffer & | getBuffer () const |
| Get the sound buffer containing the captured audio data. | |
| Public Member Functions inherited from sf::SoundRecorder | |
| virtual | ~SoundRecorder () |
| destructor | |
| bool | start (unsigned int sampleRate=44100) |
| Start the capture. | |
| void | stop () |
| Stop the capture. | |
| unsigned int | getSampleRate () const |
| Get the sample rate. | |
| bool | setDevice (const std::string &name) |
| Set the audio capture device. | |
| const std::string & | getDevice () const |
| Get the name of the current audio capture device. | |
| void | setChannelCount (unsigned int channelCount) |
| Set the channel count of the audio capture device. | |
| unsigned int | getChannelCount () const |
| Get the number of channels used by this recorder. | |
| const std::vector< SoundChannel > & | getChannelMap () const |
| Get the map of position in sample frame to sound channel. | |
Protected Member Functions | |
| bool | onStart () override |
| Start capturing audio data. | |
| bool | onProcessSamples (const std::int16_t *samples, std::size_t sampleCount) override |
| Process a new chunk of recorded samples. | |
| void | onStop () override |
| Stop capturing audio data. | |
| Protected Member Functions inherited from sf::SoundRecorder | |
| SoundRecorder () | |
| Default constructor. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from sf::SoundRecorder | |
| static std::vector< std::string > | getAvailableDevices () |
| Get a list of the names of all available audio capture devices. | |
| static std::string | getDefaultDevice () |
| Get the name of the default audio capture device. | |
| static bool | isAvailable () |
| Check if the system supports audio capture. | |
Specialized SoundRecorder which stores the captured audio data into a sound buffer.
sf::SoundBufferRecorder allows to access a recorded sound through a sf::SoundBuffer, so that it can be played, saved to a file, etc.
It has the same simple interface as its base class (start(), stop()) and adds a function to retrieve the recorded sound buffer (getBuffer()).
As usual, don't forget to call the isAvailable() function before using this class (see sf::SoundRecorder for more details about this).
Usage example:
|
override |
destructor
|
nodiscard |
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.
|
nodiscardoverrideprotectedvirtual |
Process a new chunk of recorded samples.
| samples | Pointer to the new chunk of recorded samples |
| sampleCount | Number of samples pointed by samples |
Implements sf::SoundRecorder.
|
nodiscardoverrideprotectedvirtual |
Start capturing audio data.
Reimplemented from sf::SoundRecorder.
|
overrideprotectedvirtual |
Stop capturing audio data.
Reimplemented from sf::SoundRecorder.