default:
assert(false);
}
+ audio_format.sample_rate = sample_rate;
//printf("num_periods=%u period_size=%u buffer_frames=%u sample_rate=%u bits_per_sample=%d\n",
// num_periods, unsigned(period_size), unsigned(buffer_frames), sample_rate, audio_format.bits_per_sample);
if (should_quit.should_quit()) {
// Don't call free_card(); that would be a deadlock.
- WARN_ON_ERROR("snd_pcm_close()", snd_pcm_close(pcm_handle));
+ if (pcm_handle) {
+ WARN_ON_ERROR("snd_pcm_close()", snd_pcm_close(pcm_handle));
+ }
pcm_handle = nullptr;
return;
}