Arduino LibLAME
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
liblame::MP3EncoderLAME Class Reference

Encodes PCM data to the MP3 format and writes the result to a stream or provides it via a callback. More...

#include <MP3EncoderLAME.h>

Public Member Functions

 MP3EncoderLAME ()
 
 MP3EncoderLAME (MP3CallbackFDK cb)
 Constructor which provides the decoded result in a callback.
 
void setDataCallback (MP3CallbackFDK cb)
 Defines the callback which receives the encded MP3 data.
 
 MP3EncoderLAME (Print &out_stream)
 
void setOutput (Print &out_stream)
 Defines the output stream.
 
void begin ()
 Opens the encoder.
 
void begin (AudioInfo in)
 Opens the encoder. More...
 
void begin (int input_channels, int input_sample_rate, int input_bits_per_sample)
 Opens the encoder. More...
 
void setAudioInfo (AudioInfo in)
 Defines the audio information.
 
AudioInfo audioInfo ()
 Provides the audio information.
 
int32_t write (void *pcm_samples, int bytes)
 write PCM data to be converted to MP3 - The size is in bytes
 
void end ()
 closes the processing and release resources
 
 operator boolean ()
 

Protected Member Functions

bool setupOutputBuffer (int size)
 
bool setup ()
 
short * convertToShort (void *pcm_samples, int bytes)
 
void provideResult (uint8_t *data, size_t bytes)
 return the result PWM data
 

Protected Attributes

bool active
 
MP3CallbackFDK MP3Callback = nullptr
 
AudioInfo info
 
lame_t lame = nullptr
 
uint8_t * mp3_buffer = nullptr
 
int mp3_buffer_size = 0
 
short * convert_buffer = nullptr
 
int convert_buffer_size = 0
 
Print * out
 

Detailed Description

Encodes PCM data to the MP3 format and writes the result to a stream or provides it via a callback.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ MP3EncoderLAME() [1/2]

liblame::MP3EncoderLAME::MP3EncoderLAME ( )
inline

Empty Constructor: call setDataCallback or setStream to define how the result should be provided.

◆ MP3EncoderLAME() [2/2]

liblame::MP3EncoderLAME::MP3EncoderLAME ( Print &  out_stream)
inline

Constructor which makes sure that the decoded result is written to the indicatd Stream

Member Function Documentation

◆ begin() [1/2]

void liblame::MP3EncoderLAME::begin ( AudioInfo  in)
inline

Opens the encoder.

Parameters
info
Returns
int

◆ begin() [2/2]

void liblame::MP3EncoderLAME::begin ( int  input_channels,
int  input_sample_rate,
int  input_bits_per_sample 
)
inline

Opens the encoder.

Parameters
input_channels
input_sample_rate
input_bits_per_sample
Returns
int 0 => ok; error with negative number

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