MCPcopy Create free account
hub / github.com/audacity/audacity / FillInputChannels

Method FillInputChannels

src/toolbars/DeviceToolBar.cpp:519–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

517}
518
519void DeviceToolBar::FillInputChannels()
520{
521 const std::vector<DeviceSourceMap> &inMaps = DeviceManager::Instance()->GetInputDeviceMaps();
522 auto host = AudioIOHost.Read();
523 auto device = AudioIORecordingDevice.Read();
524 auto source = AudioIORecordingSource.Read();
525 long newChannels;
526
527 auto oldChannels = AudioIORecordChannels.Read();
528 mInputChannels->Clear();
529 for (auto & dev: inMaps) {
530 if (source == dev.sourceString &&
531 device == dev.deviceString &&
532 host == dev.hostString) {
533
534 // add one selection for each channel of this source
535 for (size_t j = 0; j < (unsigned int) dev.numChannels; j++) {
536 wxString name;
537
538 if (j == 0) {
539 name = _("1 (Mono) Recording Channel");
540 }
541 else if (j == 1) {
542 name = _("2 (Stereo) Recording Channels");
543 }
544 else {
545 name = wxString::Format(wxT("%d"), (int) j + 1);
546 }
547 mInputChannels->Append(name);
548 }
549 newChannels = dev.numChannels;
550 if (oldChannels <= newChannels && oldChannels >= 1) {
551 newChannels = oldChannels;
552 }
553 if (newChannels >= 1) {
554 mInputChannels->SetSelection(newChannels - 1);
555 }
556 AudioIORecordChannels.Write(newChannels);
557 break;
558 }
559 }
560 mInputChannels->Enable(mInputChannels->GetCount() ? true : false);
561
562 mInputChannels->SetMinSize(wxSize(50, wxDefaultCoord));
563}
564
565void DeviceToolBar::OnRescannedDevices(DeviceChangeMessage m)
566{

Callers

nothing calls this directly

Calls 9

wxSizeClass · 0.70
InstanceClass · 0.50
ReadMethod · 0.45
ClearMethod · 0.45
AppendMethod · 0.45
SetSelectionMethod · 0.45
WriteMethod · 0.45
EnableMethod · 0.45
GetCountMethod · 0.45

Tested by

no test coverage detected