7 static uint32_t gcd(uint32_t a, uint32_t b) {
17 : bits_per_sample_(bits_per_sample), channels_(channels), sample_rate_(sample_rate) {
28 uint32_t frames_for_ms_calculation = *total_frames - unprocessable_frames;
30 uint32_t playback_ms = (frames_for_ms_calculation * 1000) / this->
sample_rate_;
31 *total_frames = unprocessable_frames;
42 #ifdef USE_AUDIO_FLAC_SUPPORT 46 #ifdef USE_AUDIO_MP3_SUPPORT 58 size_t samples_to_scale) {
60 for (
int i = 0; i < samples_to_scale; i++) {
61 int32_t acc = (int32_t) audio_samples[i] * (int32_t) scale_factor;
62 output_buffer[i] = (int16_t) (acc >> 15);
bool operator==(const AudioStreamInfo &rhs) const
uint8_t get_channels() const
uint8_t get_bits_per_sample() const
uint32_t frames_to_milliseconds_with_remainder(uint32_t *frames) const
Computes the duration, in milliseconds, the given amount of frames represents.
uint32_t get_sample_rate() const
uint32_t ms_sample_rate_gcd_
uint32_t frames_to_microseconds(uint32_t frames) const
Computes the duration, in microseconds, the given amount of frames represents.
Implementation of SPI Controller mode.
void scale_audio_samples(const int16_t *audio_samples, int16_t *output_buffer, int16_t scale_factor, size_t samples_to_scale)
Scales Q15 fixed point audio samples.
const char * audio_file_type_to_string(AudioFileType file_type)
Helper function to convert file type to a const char string.