| 517 | } |
| 518 | |
| 519 | void 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 | |
| 565 | void DeviceToolBar::OnRescannedDevices(DeviceChangeMessage m) |
| 566 | { |