arduino-audio-tools
All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Modules Pages
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
DecoderALAC Class Reference

ALAC (Apple Lossless Audio Codec) decoder. This class depends on https://github.com/pschatzmann/codec-alac. This implementaion is based on https://github.com/macosforge/alac. More...

#include <CodecALAC.h>

Inheritance diagram for DecoderALAC:
AudioDecoder AudioWriter AudioInfoSource AudioInfoSupport

Public Member Functions

 DecoderALAC (int frameSize=kALACDefaultFrameSize)
 Default constructor: you can define your own optimized frame size.
 
virtual void addNotifyAudioChange (AudioInfoSupport &bi)
 Adds target to be notified about audio changes.
 
AudioInfo audioInfo () override
 provides the actual input AudioInfo
 
virtual AudioInfo audioInfoOut ()
 
bool begin () override
 
virtual bool begin (AudioInfo info) override
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
void end () override
 
int frameSize ()
 Provides the actual frame size.
 
PrintgetOutput ()
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
virtual bool isResultPCM ()
 Returns true to indicate that the decoding result is PCM data.
 
 operator bool ()
 
virtual bool removeNotifyAudioChange (AudioInfoSupport &bi)
 Removes a target in order not to be notified about audio changes.
 
void setAudioInfo (AudioInfo from) override
 Update the global decoder info.
 
bool setCodecConfig (ALACBinaryConfig cfg)
 write Magic Cookie (ALACSpecificConfig)
 
bool setCodecConfig (ALACSpecificConfig config)
 
bool setCodecConfig (const uint8_t *data, size_t len) override
 write Magic Cookie (ALACSpecificConfig)
 
void setFrameSize (int frames)
 
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active)
 
virtual void setOutput (AudioOutput &out_stream)
 Defines where the decoded result is written to.
 
virtual void setOutput (AudioStream &out_stream)
 Defines where the decoded result is written to.
 
virtual void setOutput (Print &out_stream) override
 Defines where the decoded result is written to.
 
size_t write (const uint8_t *encodedFrame, size_t encodedLen) override
 we expect the write is called for a complete frame!
 

Public Attributes

int id
 custom id to be used by application
 

Protected Member Functions

void convertToNetworkFormat (ALACSpecificConfig &config)
 Convert to big endian so that we can use it in Init()
 
void notifyAudioChange (AudioInfo info)
 
int outputBufferSize ()
 Calculate the output buffer size based on the current configuration.
 
void setDefaultConfig ()
 
void writeBlocking (Print *out, uint8_t *data, size_t len)
 

Protected Attributes

struct BitBuffer bits
 
ALACDecoder dec
 
AudioInfo info
 
bool is_init = false
 
bool is_notify_active = true
 
Vector< AudioInfoSupport * > notify_vector
 
Printp_print = nullptr
 
Vector< uint8_t > result_buffer
 

Detailed Description

ALAC (Apple Lossless Audio Codec) decoder. This class depends on https://github.com/pschatzmann/codec-alac. This implementaion is based on https://github.com/macosforge/alac.

Note
Please note that this codec usually needs a container: The write() method expects a complete frame to be written! The decoder also expects to get the config from the encoder, however we have some fallback functionality that uses the AudioInfo and the frame size defined in the constructor.
Author
Phil Schatzmann

Member Function Documentation

◆ addNotifyAudioChange()

virtual void addNotifyAudioChange ( AudioInfoSupport bi)
inlinevirtualinherited

◆ audioInfo()

AudioInfo audioInfo ( )
inlineoverridevirtualinherited

◆ audioInfoOut()

virtual AudioInfo audioInfoOut ( )
inlinevirtualinherited

◆ begin() [1/2]

bool begin ( )
inlineoverridevirtualinherited

◆ begin() [2/2]

virtual bool begin ( AudioInfo  info)
inlineoverridevirtualinherited

Reimplemented from AudioWriter.

◆ end()

void end ( )
inlineoverridevirtualinherited

◆ isResultPCM()

virtual bool isResultPCM ( )
inlinevirtualinherited

Returns true to indicate that the decoding result is PCM data.

Reimplemented in CopyDecoder, DecoderNetworkFormat, GGWaveDecoder, and ContainerM4A.

◆ operator bool()

operator bool ( )
inlinevirtual

Implements AudioWriter.

◆ setAudioInfo()

void setAudioInfo ( AudioInfo  from)
inlineoverridevirtual

Update the global decoder info.

Reimplemented from AudioDecoder.

◆ setCodecConfig()

bool setCodecConfig ( const uint8_t *  data,
size_t  len 
)
inlineoverridevirtual

write Magic Cookie (ALACSpecificConfig)

Reimplemented from AudioDecoder.

◆ setFrameSize()

void setFrameSize ( int  frames)
inline

Set the default frame size: this will be overwritten if you call setCodecConfig()

◆ setOutput() [1/3]

virtual void setOutput ( AudioOutput out_stream)
inlinevirtualinherited

Defines where the decoded result is written to.

Reimplemented in ADTSDecoder, MTSDecoder, MTSDecoderTSDemux, and MetaDataFilterDecoder.

◆ setOutput() [2/3]

virtual void setOutput ( AudioStream out_stream)
inlinevirtualinherited

Defines where the decoded result is written to.

Reimplemented in ADTSDecoder, MTSDecoder, MTSDecoderTSDemux, and MetaDataFilterDecoder.

◆ setOutput() [3/3]

virtual void setOutput ( Print out_stream)
inlineoverridevirtualinherited

◆ write()

size_t write ( const uint8_t *  encodedFrame,
size_t  encodedLen 
)
inlineoverridevirtual

we expect the write is called for a complete frame!

Implements AudioWriter.


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