class EE::Audio::SoundBufferRecorder


Specialized SoundRecorder which stores the captured audio data into a sound buffer. More…

#include <soundbufferrecorder.hpp>

class SoundBufferRecorder: public EE::Audio::SoundRecorder {
    // construction


    // methods

    const SoundBuffer& getBuffer() const;

Inherited Members

    // methods

    bool start(unsigned int sampleRate = 44100);
    void stop();
    unsigned int getSampleRate() const;
    bool setDevice(const std::string& name);
    const std::string& getDevice() const;
    void setChannelCount(unsigned int channelCount);
    unsigned int getChannelCount() const;
    bool isCapturing();
    static std::vector<std::string> getAvailableDevices();
    static std::string getDefaultDevice();
    static bool isAvailable();

Detailed Documentation

Specialized SoundRecorder which stores the captured audio data into a sound buffer.

SoundBufferRecorder allows to access a recorded sound through a 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 SoundRecorder for more details about this).

Usage example:

if (SoundBufferRecorder::isAvailable())
 // Record some audio data
 SoundBufferRecorder recorder;

 // Get the buffer containing the captured audio data
 const SoundBuffer& buffer = recorder.getBuffer();

 // Save it to a file (for example...)

See also:



const SoundBuffer& getBuffer() const

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.


Read-only access to the sound buffer