.. index:: pair: class; EE::Audio::SoundBufferRecorder .. _doxid-class_e_e_1_1_audio_1_1_sound_buffer_recorder: class EE::Audio::SoundBufferRecorder ==================================== .. toctree:: :hidden: Overview ~~~~~~~~ Specialized :ref:`SoundRecorder ` which stores the captured audio data into a sound buffer. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class SoundBufferRecorder: public :ref:`EE::Audio::SoundRecorder` { public: // construction :target:`~SoundBufferRecorder`(); // methods const :ref:`SoundBuffer`& :ref:`getBuffer`() const; }; Inherited Members ----------------- .. ref-code-block:: cpp :class: doxyrest-overview-inherited-code-block public: // methods bool :ref:`start`(unsigned int sampleRate = 44100); void :ref:`stop`(); unsigned int :ref:`getSampleRate`() const; bool :ref:`setDevice`(const std::string& name); const std::string& :ref:`getDevice`() const; void :ref:`setChannelCount`(unsigned int channelCount); unsigned int :ref:`getChannelCount`() const; bool :ref:`isCapturing`(); static std::vector :ref:`getAvailableDevices`(); static std::string :ref:`getDefaultDevice`(); static bool :ref:`isAvailable`(); .. _details-class_e_e_1_1_audio_1_1_sound_buffer_recorder: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Specialized :ref:`SoundRecorder ` which stores the captured audio data into a sound buffer. :ref:`SoundBufferRecorder ` allows to access a recorded sound through a :ref:`SoundBuffer `, so that it can be played, saved to a file, etc. It has the same simple interface as its base class (:ref:`start() `, :ref:`stop() `) and adds a function to retrieve the recorded sound buffer (:ref:`getBuffer() `). As usual, don't forget to call the :ref:`isAvailable() ` function before using this class (see :ref:`SoundRecorder ` for more details about this). Usage example: .. ref-code-block:: cpp if (SoundBufferRecorder::isAvailable()) { // Record some audio data SoundBufferRecorder recorder; recorder.start(); ... recorder.stop(); // Get the buffer containing the captured audio data const SoundBuffer& buffer = recorder.getBuffer(); // Save it to a file (for example...) buffer.saveToFile("my_record.ogg"); } .. rubric:: See also: :ref:`SoundRecorder ` Methods ------- .. index:: pair: function; getBuffer .. _doxid-class_e_e_1_1_audio_1_1_sound_buffer_recorder_1ab5b51366b72a653ae60416686af239ea: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`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. .. rubric:: Returns: Read-only access to the sound buffer