arduino-audio-tools
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SBCEncoder Class Reference

Encoder for SBC - Depends on https://github.com/pschatzmann/arduino-libsbc. Inspired by sbcenc.c. More...

#include <CodecSBC.h>

Inheritance diagram for SBCEncoder:
AudioEncoder AudioWriter AudioInfoSupport

Public Member Functions

 SBCEncoder (int subbands=8, int blocks=16, int bitpool=32, int allocation_method=SBC_AM_LOUDNESS)
 
AudioInfo audioInfo ()
 provides the actual input AudioInfo
 
virtual AudioInfo audioInfoOut ()
 provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
 
bool begin ()
 Restarts the processing.
 
virtual bool begin (AudioInfo info)
 
int bytesCompressed ()
 
int bytesUncompressed ()
 
virtual void end ()
 Ends the processing.
 
virtual const char * mime ()
 Provides the mime type of the encoded result.
 
 operator bool ()
 
void setAllocationMethod (int allocation_method)
 Defines the allocation method: Use SBC_AM_LOUDNESS, SBC_AM_SNR.
 
void setAudioInfo (AudioInfo from) override
 Defines the sample rate, number of channels and bits per sample.
 
void setBitpool (int bitpool)
 Defines the bitpool (2-86?)
 
void setBlocks (int blocks)
 Defines the number of blocks: valid values (4,8,12,16)
 
virtual void setOutput (Print &out_stream)
 
void setSubbands (int subbands)
 Defines the subbands: Use 4 or 8.
 
virtual size_t write (const void *in_ptr, size_t in_size)
 

Protected Member Functions

int codeSize ()
 Provides the uncompressed length (of the PCM data) in bytes.
 
int frameLength ()
 Provides the compressed length in bytes (after encoding)
 
void processByte (uint8_t byte)
 
bool setup ()
 Determines audio information and calls sbc_init;.
 
void writeBlocking (Print *out, uint8_t *data, size_t len)
 

Protected Attributes

int allocation_method
 
int bitpool = 32
 
int blocks = 4
 
Vector< uint8_t > buffer {0}
 
int buffer_pos = 0
 
int current_codesize = 0
 
AudioInfo info
 
bool is_active = false
 
bool is_first = true
 
Printp_print = nullptr
 
Vector< uint8_t > result_buffer {0}
 
sbc_t sbc
 
int subbands = 4
 

Detailed Description

Encoder for SBC - Depends on https://github.com/pschatzmann/arduino-libsbc. Inspired by sbcenc.c.

Author
Phil Schatzmann

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