Class OcsfmlAudio.sound_buffer_recorder

class sound_buffer_recorder : object .. end
Specialized sound_recorder which stores the captured audio data into a sound buffer.

OcsfmlAudio.sound_buffer_recorder allows to access a recorded sound through a OcsfmlAudio.sound_buffer, 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 (get_buffer).

As usual, don't forget to call the SoundRecorder.is_available() function before using this class (see OcsfmlAudio.SoundRecorder for more details about this).

Usage example:

    if SoundRecorder.is_available ()
    then begin
    (* Record some audio data *)
    let recorder = new sound_buffer_recorder in
    recorder#start () ;
    ...
    recorder#stop ;
    
    (* Get the buffer containing the captured audio data *)
    let buffer = recorder#getBuffer in
    
    (* Save it to a file (for example...) *)
    buffer#save_to_file "my_record.ogg"
    end
    

Inherits
method destroy : unit
method get_buffer : const_sound_buffer reference
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.