25#ifndef SFML_SOUNDRECORDER_HPP
26#define SFML_SOUNDRECORDER_HPP
31#include <SFML/Audio/Export.hpp>
32#include <SFML/Audio/AlResource.hpp>
33#include <SFML/System/Thread.hpp>
34#include <SFML/System/Time.hpp>
77 bool start(
unsigned int sampleRate = 44100);
275 void processCapturedSamples();
289 std::vector<Int16> m_samples;
290 unsigned int m_sampleRate;
291 Time m_processingInterval;
293 std::string m_deviceName;
294 unsigned int m_channelCount;
Base class for classes that require an OpenAL context.
Abstract base class for capturing sound data.
const std::string & getDevice() const
Get the name of the current audio capture device.
virtual bool onProcessSamples(const Int16 *samples, std::size_t sampleCount)=0
Process a new chunk of recorded samples.
static std::vector< std::string > getAvailableDevices()
Get a list of the names of all available audio capture devices.
SoundRecorder()
Default constructor.
unsigned int getChannelCount() const
Get the number of channels used by this recorder.
bool start(unsigned int sampleRate=44100)
Start the capture.
virtual bool onStart()
Start capturing audio data.
void setProcessingInterval(Time interval)
Set the processing interval.
void stop()
Stop the capture.
bool setDevice(const std::string &name)
Set the audio capture device.
static bool isAvailable()
Check if the system supports audio capture.
virtual ~SoundRecorder()
destructor
static std::string getDefaultDevice()
Get the name of the default audio capture device.
void setChannelCount(unsigned int channelCount)
Set the channel count of the audio capture device.
unsigned int getSampleRate() const
Get the sample rate.
virtual void onStop()
Stop capturing audio data.
Utility class to manipulate threads.