11 #ifndef SAMPLEHUFFMAN_H 12 #define SAMPLEHUFFMAN_H 72 if(datapos >= sounddata_bits){
81 int16_t dif = decode();
115 uint8_t
const * sounddata;
116 int16_t
const * huffman;
117 uint32_t
const sounddata_bits;
127 const uint8_t b = datapos&7;
129 if(!b) bt = FLASH_OR_RAM_READ<
const uint8_t>(sounddata+((uint32_t)datapos>>3));
131 return ((uint8_t)bt>>(7-b))&1;
139 int16_t
const * huffcode = huffman;
142 const int16_t offs = FLASH_OR_RAM_READ<
const int16_t>(huffcode);
143 huffcode += offs?offs+1:2;
147 while(FLASH_OR_RAM_READ<
const int16_t>(huffcode++));
148 return FLASH_OR_RAM_READ<
const int16_t>(huffcode);
void setLoopingOn()
Turns looping on, with the whole sample length as the loop range.
SampleHuffman(uint8_t const *SOUNDDATA, int16_t const *HUFFMAN_DATA, uint32_t const SOUNDDATA_BITS)
Constructor.
void start()
Sets the playhead to the beginning of the sample.
void setLoopingOff()
Turns looping off.
int16_t next()
Update and return the next audio sample.