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

MP3 Decoder using https://github.com/pschatzmann/minimp3. This decoder does not provide any good results and it is not suited to decode any audio above 32000 on an ESP32. So the sample rate is limited by the MINIMP3_MAX_SAMPLE_RATE variable. More...

#include <CodecMP3Mini.h>

Inheritance diagram for audio_tools::MP3DecoderMini:
audio_tools::AudioDecoder audio_tools::AudioWriter audio_tools::AudioBaseInfoSource

Public Member Functions

 ~MP3DecoderMini ()
 Destroy the MP3DecoderMini object.
 
AudioBaseInfo audioInfo ()
 Provides the last available MP3FrameInfo. More...
 
void begin ()
 Starts the processing. More...
 
void end ()
 Releases the reserved memory. More...
 
void flush ()
 Decodes the last outstanding data.
 
virtual operator bool ()
 checks if the class is active More...
 
void setBufferLength (int len)
 
void setNotifyAudioChange (AudioBaseInfoDependent &bi)
 
void setOutputStream (Print &outStream)
 Defines the output Stream. More...
 
void setSampleRateLimit (int limit)
 
size_t write (const void *data, size_t len)
 Write mp3 data to decoder. More...
 
- Public Member Functions inherited from audio_tools::AudioDecoder
 AudioDecoder (AudioDecoder const &)=delete
 
virtual AudioBaseInfo audioInfo ()=0
 
virtual bool isResultPCM ()
 
AudioDecoderoperator= (AudioDecoder const &)=delete
 
virtual void setAudioInfo (AudioBaseInfo from) override
 
virtual void setOutputStream (AudioPrint &out_stream)
 
virtual void setOutputStream (AudioStream &out_stream)
 
virtual void setOutputStream (Print &out_stream) override=0
 
virtual void begin ()=0
 
virtual void end ()=0
 
virtual operator bool ()=0
 
virtual void setAudioInfo (AudioBaseInfo from)=0
 
virtual void setOutputStream (Print &out_stream)=0
 
virtual size_t write (const void *in_ptr, size_t in_size)=0
 
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi)=0
 

Protected Member Functions

void decode (int write_len)
 Process single bytes so that we can decode a full frame when it is available.
 
void f32_to_s16 (float *in, int16_t *out, int num_samples)
 
void provideResult (int samples)
 Provides Metadata and PCM data.
 

Protected Attributes

bool active
 
AudioBaseInfo audio_info
 
AudioBaseInfoDependentaudioBaseInfoSupport = nullptr
 
Vector< uint8_t > buffer
 
size_t buffer_pos = 0
 
size_t buffer_size = 5 * 1024
 
mp3dec_t mp3d
 
mp3dec_frame_info_t mp3dec_info
 
Printout = nullptr
 
Vector< mp3d_sample_t > pcm
 
Vector< int16_t > pcm16
 
int sample_rate_limit = MINIMP3_MAX_SAMPLE_RATE
 

Detailed Description

MP3 Decoder using https://github.com/pschatzmann/minimp3. This decoder does not provide any good results and it is not suited to decode any audio above 32000 on an ESP32. So the sample rate is limited by the MINIMP3_MAX_SAMPLE_RATE variable.

Author
Phil Schatzmann

Member Function Documentation

◆ audioInfo()

AudioBaseInfo audio_tools::MP3DecoderMini::audioInfo ( )
inlinevirtual

Provides the last available MP3FrameInfo.

Implements audio_tools::AudioDecoder.

◆ begin()

void audio_tools::MP3DecoderMini::begin ( )
inlinevirtual

Starts the processing.

Implements audio_tools::AudioWriter.

◆ end()

void audio_tools::MP3DecoderMini::end ( )
inlinevirtual

Releases the reserved memory.

Implements audio_tools::AudioWriter.

◆ operator bool()

virtual audio_tools::MP3DecoderMini::operator bool ( )
inlinevirtual

checks if the class is active

Implements audio_tools::AudioWriter.

◆ setNotifyAudioChange()

void audio_tools::MP3DecoderMini::setNotifyAudioChange ( AudioBaseInfoDependent bi)
inlinevirtual

◆ setOutputStream()

void audio_tools::MP3DecoderMini::setOutputStream ( Print outStream)
inlinevirtual

Defines the output Stream.

Implements audio_tools::AudioDecoder.

◆ write()

size_t audio_tools::MP3DecoderMini::write ( const void *  data,
size_t  len 
)
inlinevirtual

Write mp3 data to decoder.

Implements audio_tools::AudioWriter.


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