- switch (audio_format.bits_per_sample) {
- case 0:
- assert(num_samples == 0);
- break;
- case 24:
- convert_fixed24_to_fp32(&audio[0], num_channels, data, audio_format.num_channels, num_samples);
- break;
- case 32:
- convert_fixed32_to_fp32(&audio[0], num_channels, data, audio_format.num_channels, num_samples);
- break;
- default:
- fprintf(stderr, "Cannot handle audio with %u bits per sample\n", audio_format.bits_per_sample);
- assert(false);
+ unsigned channel_index = 0;
+ for (auto channel_it = card->interesting_channels.cbegin(); channel_it != card->interesting_channels.end(); ++channel_it, ++channel_index) {
+ switch (audio_format.bits_per_sample) {
+ case 0:
+ assert(num_samples == 0);
+ break;
+ case 24:
+ convert_fixed24_to_fp32(&audio[0], channel_index, num_channels, data, *channel_it, audio_format.num_channels, num_samples);
+ break;
+ case 32:
+ convert_fixed32_to_fp32(&audio[0], channel_index, num_channels, data, *channel_it, audio_format.num_channels, num_samples);
+ break;
+ default:
+ fprintf(stderr, "Cannot handle audio with %u bits per sample\n", audio_format.bits_per_sample);
+ assert(false);
+ }