X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=audio_mixer.cpp;h=b61a3c300009eda219179863617914325517ba1e;hb=95c6bc9d8e340b02112f713389390102d547cc4c;hp=93d59f4cc6f4017d9d43bc5ab45ff09b4710fe9f;hpb=0f4b5fde73be7c8606d5812b8007cb23b8083bb6;p=nageru diff --git a/audio_mixer.cpp b/audio_mixer.cpp index 93d59f4..b61a3c3 100644 --- a/audio_mixer.cpp +++ b/audio_mixer.cpp @@ -252,6 +252,9 @@ vector AudioMixer::get_output(double pts, unsigned num_samples, Resamplin lock_guard lock(audio_mutex); // Pick out all the interesting channels from all the cards. + // TODO: If the card has been hotswapped, the number of channels + // might have changed; if so, we need to do some sort of remapping + // to silence. for (unsigned card_index = 0; card_index < num_cards; ++card_index) { AudioDevice *device = &cards[card_index]; if (!device->interesting_channels.empty()) { @@ -396,16 +399,19 @@ vector AudioMixer::get_output(double pts, unsigned num_samples, Resamplin return samples_out; } -map AudioMixer::get_names() const +map AudioMixer::get_devices() const { lock_guard lock(audio_mutex); - map names; + map devices; for (unsigned card_index = 0; card_index < num_cards; ++card_index) { const DeviceSpec spec{ InputSourceType::CAPTURE_CARD, card_index }; const AudioDevice *device = &cards[card_index]; - names.insert(make_pair(spec, device->name)); + DeviceInfo info; + info.name = device->name; + info.num_channels = 8; // FIXME: This is wrong for fake cards. + devices.insert(make_pair(spec, info)); } - return names; + return devices; } void AudioMixer::set_name(DeviceSpec device_spec, const string &name)