79 [[nodiscard]]
bool start(
unsigned int sampleRate = 44100);
237 [[nodiscard]]
virtual bool onProcessSamples(
const std::int16_t* samples, std::size_t sampleCount) = 0;
255 const std::unique_ptr<Impl> m_impl;
const std::string & getDevice() const
Get the name of the current audio capture device.
const std::vector< SoundChannel > & getChannelMap() const
Get the map of position in sample frame to sound channel.
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 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 bool onProcessSamples(const std::int16_t *samples, std::size_t sampleCount)=0
Process a new chunk of recorded samples.
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.