arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
MP3EncoderShine Class Reference

Lean MP3 Encoder using the shine library. More...

#include <CodecMP3Shine.h>

Inheritance diagram for MP3EncoderShine:
AudioEncoder AudioWriter AudioInfoSupport

Public Member Functions

 MP3EncoderShine ()=default
 
 ~MP3EncoderShine () override
 
AudioInfo audioInfo () override
 provides the actual input AudioInfo
 
AudioInfo audioInfoOut () override
 
bool begin () override
 
virtual bool begin (AudioInfo info)
 
void end () override
 
void flush ()
 
uint32_t frameDurationUs () override
 Optional rtsp function: provide the frame duration in microseconds.
 
const charmime () override
 Provides the mime type of the encoded result.
 
 operator bool () override
 
uint16_t samplesPerFrame () override
 Optional rtsp function: provide samples per the frame.
 
void setAudioInfo (AudioInfo from) override
 Defines the sample rate, number of channels and bits per sample.
 
void setBitrate (int br)
 Request the bitrate for encoding (in kbps).
 
void setCopyright (bool copyright)
 Sets the copyright flag for encoding.
 
void setDeemphasis (emph deemphasis)
 
void setMode (modes mode)
 
void setOriginal (bool original)
 Sets the original flag for encoding.
 
void setOutput (Print &out_stream) override
 Default output assignment (encoders may override to store Print reference)
 
size_t write (const uint8_t *data, size_t len) override
 

Protected Member Functions

void writeBlocking (Print *out, uint8_t *data, size_t len)
 
int writeMP3 ()
 

Static Protected Member Functions

static int selectBitrateFast (int sr, int req)
 

Protected Attributes

int _bitrate = 128
 
shine_config_t _config {}
 
Print_out = nullptr
 
SingleBuffer< uint8_t_pcm_buffer
 
shine_t _shine = nullptr
 
AudioInfo info
 

Detailed Description

Lean MP3 Encoder using the shine library.

Note
please install the shine library first: https://github.com/pschatzmann/codec-shine
Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ MP3EncoderShine()

MP3EncoderShine ( )
default

◆ ~MP3EncoderShine()

~MP3EncoderShine ( )
inlineoverride

Member Function Documentation

◆ audioInfo()

AudioInfo audioInfo ( )
inlineoverridevirtual

provides the actual input AudioInfo

Reimplemented from AudioEncoder.

◆ audioInfoOut()

AudioInfo audioInfoOut ( )
inlineoverridevirtual

provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream

Reimplemented from AudioInfoSupport.

◆ begin() [1/2]

bool begin ( )
inlineoverridevirtual

Implements AudioWriter.

◆ begin() [2/2]

virtual bool begin ( AudioInfo  info)
inlinevirtualinherited

◆ end()

void end ( )
inlineoverridevirtual

Implements AudioWriter.

◆ flush()

void flush ( )
inline

◆ frameDurationUs()

uint32_t frameDurationUs ( )
inlineoverridevirtual

Optional rtsp function: provide the frame duration in microseconds.

Reimplemented from AudioEncoder.

◆ mime()

const char * mime ( )
inlineoverridevirtual

Provides the mime type of the encoded result.

Implements AudioEncoder.

◆ operator bool()

operator bool ( )
inlineoverridevirtual

Implements AudioWriter.

◆ samplesPerFrame()

uint16_t samplesPerFrame ( )
inlineoverridevirtual

Optional rtsp function: provide samples per the frame.

Reimplemented from AudioEncoder.

◆ selectBitrateFast()

static int selectBitrateFast ( int  sr,
int  req 
)
inlinestaticprotected

◆ setAudioInfo()

void setAudioInfo ( AudioInfo  from)
inlineoverridevirtual

Defines the sample rate, number of channels and bits per sample.

Reimplemented from AudioEncoder.

◆ setBitrate()

void setBitrate ( int  br)
inline

Request the bitrate for encoding (in kbps).

◆ setCopyright()

void setCopyright ( bool  copyright)
inline

Sets the copyright flag for encoding.

◆ setDeemphasis()

void setDeemphasis ( emph  deemphasis)
inline

Sets the deemphasis filter for encoding (e.g. for old recordings)

Parameters
deemphasisNONE = 0, MU50_15 = 1, CITT = 3 }

◆ setMode()

void setMode ( modes  mode)
inline

Sets the mode for encoding (STEREO = 0, JOINT_STEREO = 1, DUAL_CHANNEL = 2, MONO = 3 )

◆ setOriginal()

void setOriginal ( bool  original)
inline

Sets the original flag for encoding.

◆ setOutput()

void setOutput ( Print out_stream)
inlineoverridevirtual

Default output assignment (encoders may override to store Print reference)

Reimplemented from AudioEncoder.

◆ write()

size_t write ( const uint8_t data,
size_t  len 
)
inlineoverridevirtual

Implements AudioWriter.

◆ writeBlocking()

void writeBlocking ( Print out,
uint8_t data,
size_t  len 
)
inlineprotectedinherited

◆ writeMP3()

int writeMP3 ( )
inlineprotected

Member Data Documentation

◆ _bitrate

int _bitrate = 128
protected

◆ _config

shine_config_t _config {}
protected

◆ _out

Print* _out = nullptr
protected

◆ _pcm_buffer

SingleBuffer<uint8_t> _pcm_buffer
protected

◆ _shine

shine_t _shine = nullptr
protected

◆ info

AudioInfo info
protectedinherited

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