# irrklang::IAudioRecorder Class Reference

Interface to an audio recorder. Create it using the createIrrKlangAudioRecorder() function. More...

`#include <ik_IAudioRecorder.h>`

Inheritance diagram for irrklang::IAudioRecorder:

List of all members.

## Public Member Functions

virtual bool | startRecordingBufferedAudio (ik_s32 sampleRate=22000, ESampleFormat sampleFormat=ESF_S16, ik_s32 channelCount=1)=0
| Starts recording audio.
virtual bool | startRecordingCustomHandledAudio (ICapturedAudioDataReceiver *receiver, ik_s32 sampleRate=22000, ESampleFormat sampleFormat=ESF_S16, ik_s32 channelCount=1)=0
| Starts recording audio.
virtual void | stopRecordingAudio ()=0
| Stops recording audio.
virtual ISoundSource * | addSoundSourceFromRecordedAudio (const char *soundName)=0
| Creates a sound source for the recorded audio data.
virtual void | clearRecordedAudioDataBuffer ()=0
| Clears recorded audio data buffer, freeing memory.
virtual bool | isRecording ()=0
| Returns if the recorder is currently recording audio.
virtual SAudioStreamFormat | getAudioFormat ()=0
| Returns the audio format of the recorded audio data.
virtual void * | getRecordedAudioData ()=0
| Returns a pointer to the recorded audio data.
virtual const char * | getDriverName ()=0
| returns the name of the sound driver, like 'ALSA' for the alsa device.

## Detailed Description

Interface to an audio recorder. Create it using the createIrrKlangAudioRecorder() function.

It creates sound sources into an ISoundEngine which then can be played there. See Recording Audio for an example on how to use this.

## Member Function Documentation

virtual ISoundSource* irrklang::IAudioRecorder::addSoundSourceFromRecordedAudio | ( | const char * | soundName | ) | `[pure virtual]`

Creates a sound source for the recorded audio data.

The returned sound source pointer then can be used to play back the recorded audio data using ISoundEngine::play2D(). This method only will succeed if the audio was recorded using startRecordingBufferedAudio() and audio recording is currently stopped.

Parameters:

  | soundName | Name of the virtual sound file (e.g. "someRecordedAudio"). You can also use this name when calling play3D() or play2D().

virtual void irrklang::IAudioRecorder::clearRecordedAudioDataBuffer | ( |  | ) | `[pure virtual]`

Clears recorded audio data buffer, freeing memory.

This method will only succeed if audio recording is currently stopped.

virtual SAudioStreamFormat irrklang::IAudioRecorder::getAudioFormat | ( |  | ) | `[pure virtual]`

Returns the audio format of the recorded audio data.

Also contains informations about the length of the recorded audio stream.

virtual const char* irrklang::IAudioRecorder::getDriverName | ( |  | ) | `[pure virtual]`

returns the name of the sound driver, like 'ALSA' for the alsa device.

Possible returned strings are "NULL", "ALSA", "CoreAudio", "winMM", "DirectSound" and "DirectSound8".

virtual void* irrklang::IAudioRecorder::getRecordedAudioData | ( |  | ) | `[pure virtual]`

Returns a pointer to the recorded audio data.

This method will only succeed if audio recording is currently stopped and something was recorded previously using startRecordingBufferedAudio(). The lenght of the buffer can be retrieved using getAudioFormat().getSampleDataSize(). Note that the pointer is only valid as long as not clearRecordedAudioDataBuffer() is called or another sample is recorded.

virtual bool irrklang::IAudioRecorder::isRecording | ( |  | ) | `[pure virtual]`

Returns if the recorder is currently recording audio.

virtual bool irrklang::IAudioRecorder::startRecordingBufferedAudio | ( | ik_s32 | sampleRate = `22000`,
|  | ESampleFormat | sampleFormat = `ESF_S16`,
|  | ik_s32 | channelCount = `1` |
| ) |  |  | `[pure virtual]`

Starts recording audio.

Clears all possibly previously recorded buffered audio data and starts to record. When finished recording audio data, call stopRecordingAudio(). All recorded audio data gets stored into an internal audio buffer, which can then be accessed for example using addSoundSourceFromRecordedAudio() or getRecordedAudioData(). For recording audio data not into an internal audio buffer, use startRecordingCustomHandledAudio().

Parameters:

  | sampleRate,: | Sample rate of the recorded audio.
  | sampleFormat,: | Sample format of the recorded audio.
  | channelCount,: | Amount of audio channels.

Returns:
  Returns true if successfully started recording and false if not.

virtual bool irrklang::IAudioRecorder::startRecordingCustomHandledAudio | ( | ICapturedAudioDataReceiver * | receiver,
|  | ik_s32 | sampleRate = `22000`,
|  | ESampleFormat | sampleFormat = `ESF_S16`,
|  | ik_s32 | channelCount = `1` |
| ) |  |  | `[pure virtual]`

Starts recording audio.

Clears all possibly previously recorded buffered audio data and starts to record audio data, which is delivered to a custom user callback interface. When finished recording audio data, call stopRecordingAudio(). If instead of recording the data to the receiver interface recording into a managed buffer is wished, use startRecordingBufferedAudio() instead.

Parameters:

  | receiver,: | Interface to be implemented by the user, gets called once for each captured audio data chunk.
  | sampleRate,: | Sample rate of the recorded audio.
  | sampleFormat,: | Sample format of the recorded audio.
  | channelCount,: | Amount of audio channels.

Returns:
  Returns true if successfully started recording and false if not.

virtual void irrklang::IAudioRecorder::stopRecordingAudio | ( |  | ) | `[pure virtual]`

Stops recording audio.

The documentation for this class was generated from the following file:

- ik_IAudioRecorder.h

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

| The irrKlang Engine Documentation © 2003-2018 by Nikolaus Gebhardt. Generated by Doxygen (1.6.1)