10 std::function<void(
const std::vector<uint8_t> &)> filtered_callback =
11 [
this, data_callback](
const std::vector<uint8_t> &data) {
21 data_callback(*output_samples);
63 const size_t target_bytes_per_frame = target_bytes_per_sample * this->
channels_.count();
65 filtered_data.resize(target_bytes_per_frame * total_frames);
67 uint8_t *current_data = filtered_data.data();
69 for (uint32_t frame_index = 0; frame_index < total_frames; ++frame_index) {
70 for (uint32_t channel_index = 0; channel_index < source_channels; ++channel_index) {
71 if (this->
channels_.test(channel_index)) {
74 const uint32_t sample_index = frame_index * source_bytes_per_frame + channel_index * source_bytes_per_sample;
83 sample = clamp<int32_t>(sample, Q25_MIN_VALUE, Q25_MAX_VALUE);
88 current_data = current_data + target_bytes_per_sample;
void pack_q31_as_audio_sample(int32_t sample, uint8_t *data, size_t bytes_per_sample)
Packs a Q31 fixed-point number as an audio sample with the specified number of bytes per sample.