Records audio into 16-bit WAV file, with an optional tracklist.
More...
#include "SuperpoweredRecorder.h"
|
| Recorder (const char *tempPath) |
| Creates a recorder instance. More...
|
|
| ~Recorder () |
|
void | addToTracklist (char *artist, char *title, int becameAudibleSeconds=0, bool takeOwnership=false) |
| Each recording may include a tracklist, which is a .txt file placed next to the destination audio file. More...
|
|
bool | isFinished () |
|
bool | prepare (const char *destinationPath, unsigned int samplerate, bool fadeInFadeOut, unsigned int minimumLengthSeconds) |
| Prepares for recording. More...
|
|
unsigned int | recordInterleaved (float *input, unsigned int numberOfFrames) |
| Processes incoming interleaved stereo audio. More...
|
|
unsigned int | recordNonInterleaved (float *left, float *right, unsigned int numberOfFrames) |
| Processes incoming non-interleaved stereo audio. More...
|
|
void | stop () |
| Stops recording. More...
|
|
Records audio into 16-bit WAV file, with an optional tracklist.
Use this class in a real-time audio processing thread, where directly writing to a disk is not recommended. For offline processing, instead of a Superpowered Recorder use the createWAV(), writeWAV() and closeWAV() functions in SuperpoweredSimple.h. One instance allocates around 135k * numChannels memory when recording starts.
◆ Recorder() [1/2]
Superpowered::Recorder::Recorder |
( |
const char * |
tempPath | ) |
|
Creates a recorder instance.
- Warning
- Filesystem paths in C are different than paths in Java. /sdcard becomes /mnt/sdcard for example.
- Parameters
-
tempPath | The full filesystem path of a temporary file. The recorder will create and write into this while recording. |
◆ ~Recorder()
Superpowered::Recorder::~Recorder |
( |
| ) |
|
◆ Recorder() [2/2]
Superpowered::Recorder::Recorder |
( |
const Recorder & |
| ) |
|
|
private |
◆ addToTracklist()
void Superpowered::Recorder::addToTracklist |
( |
char * |
artist, |
|
|
char * |
title, |
|
|
int |
becameAudibleSeconds = 0 , |
|
|
bool |
takeOwnership = false |
|
) |
| |
Each recording may include a tracklist, which is a .txt file placed next to the destination audio file.
This method adds an entry to the tracklist. The tracklist file will not be created if this method is never called. Do not call this in a real-time audio processing thread.
- Parameters
-
artist | Artist, can be NULL. |
title | Title, can be NULL. |
becameAudibleSeconds | When the current track begins to be audible in this recording, relative to "now". For example, 0 means "now", -10 means "10 seconds ago". |
takeOwnership | If true, this class will free() artist and title. |
◆ isFinished()
bool Superpowered::Recorder::isFinished |
( |
| ) |
|
- Returns
- Returns true is the recorder has finished writing after stop() was called, so the recording is fully available at the destination path. It's safe to call this method in any thread.
◆ operator=()
◆ prepare()
bool Superpowered::Recorder::prepare |
( |
const char * |
destinationPath, |
|
|
unsigned int |
samplerate, |
|
|
bool |
fadeInFadeOut, |
|
|
unsigned int |
minimumLengthSeconds |
|
) |
| |
Prepares for recording.
The actual recording will begin on the first call of the process() method.
- Returns
- Returns true on success or false if another recording is still active or not finished writing to disk yet. Do not call this in a real-time audio processing thread.
- Parameters
-
destinationPath | The full filesystem path of the successfully finished recording. Do not include ".wav" in this, the .wav extension will be automatically appended. |
samplerate | The sample rate of the audio input and the recording, in Hz. The input sample rate must remain the same during the entire recording. |
fadeInFadeOut | If true, the recorder applies a fade-in at the beginning and a fade-out at the end of the recording. The fade is 64 frames long. |
minimumLengthSeconds | The minimum length of the recording. If the number of recorded seconds is lower, then a file will not be saved. |
◆ recordInterleaved()
unsigned int Superpowered::Recorder::recordInterleaved |
( |
float * |
input, |
|
|
unsigned int |
numberOfFrames |
|
) |
| |
Processes incoming interleaved stereo audio.
- Returns
- Seconds recorded so far. It's never blocking for real-time usage.
- Parameters
-
input | Pointer to floating point numbers. Stereo interleaved audio to record. |
numberOfFrames | The number of frames in input. |
◆ recordNonInterleaved()
unsigned int Superpowered::Recorder::recordNonInterleaved |
( |
float * |
left, |
|
|
float * |
right, |
|
|
unsigned int |
numberOfFrames |
|
) |
| |
Processes incoming non-interleaved stereo audio.
- Returns
- Seconds recorded so far. It's never blocking for real-time usage.
- Parameters
-
left | Pointer to floating point numbers. Left input channel. |
right | Pointer to floating point numbers. Right input channel. |
numberOfFrames | The number of frames in input. |
◆ stop()
void Superpowered::Recorder::stop |
( |
| ) |
|
Stops recording.
After calling stop() the recorder needs a little bit more time to write the last pieces of audio to disk. You can periodically call isFinished() to check when it's done. It's safe to call this method in any thread.
◆ internals
recorderInternals* Superpowered::Recorder::internals |
|
private |
The documentation for this class was generated from the following file:
- latest/Superpowered/SuperpoweredRecorder.h