| 620 | } |
| 621 | |
| 622 | wxMenu *AppFrame::makeAudioSampleRateMenu() { |
| 623 | // Audio Sample Rates |
| 624 | auto *pMenu = new wxMenu; |
| 625 | |
| 626 | auto outputDevices = wxGetApp().getDemodMgr().getOutputDevices(); |
| 627 | |
| 628 | #define NUM_RATES_DEFAULT 4 |
| 629 | unsigned int desired_rates[NUM_RATES_DEFAULT] = { 48000, 44100, 96000, 192000 }; |
| 630 | |
| 631 | for (auto & outputDevice : outputDevices) { |
| 632 | unsigned int desired_rate = 0; |
| 633 | unsigned int desired_rank = NUM_RATES_DEFAULT + 1; |
| 634 | |
| 635 | for (unsigned int & sampleRate : outputDevice.second.sampleRates) { |
| 636 | for (unsigned int i = 0; i < NUM_RATES_DEFAULT; i++) { |
| 637 | if (desired_rates[i] == sampleRate) { |
| 638 | if (desired_rank > i) { |
| 639 | desired_rank = i; |
| 640 | desired_rate = sampleRate; |
| 641 | } |
| 642 | } |
| 643 | } |
| 644 | } |
| 645 | |
| 646 | if (desired_rank > NUM_RATES_DEFAULT) { |
| 647 | desired_rate = outputDevice.second.sampleRates.back(); |
| 648 | } |
| 649 | AudioThread::deviceSampleRate[outputDevice.first] = desired_rate; |
| 650 | } |
| 651 | |
| 652 | for (auto & outputDevice : outputDevices) { |
| 653 | int menu_id = wxID_AUDIO_BANDWIDTH_BASE + wxID_AUDIO_DEVICE_MULTIPLIER * outputDevice.first; |
| 654 | auto *subMenu = new wxMenu; |
| 655 | pMenu->AppendSubMenu(subMenu, outputDevice.second.name, wxT("Description?")); |
| 656 | |
| 657 | int j = 0; |
| 658 | for (auto srate = outputDevice.second.sampleRates.begin(); srate != outputDevice.second.sampleRates.end(); |
| 659 | srate++) { |
| 660 | stringstream srateName; |
| 661 | srateName << ((float) (*srate) / 1000.0f) << "kHz"; |
| 662 | wxMenuItem *itm = subMenu->AppendRadioItem(menu_id + j, srateName.str(), wxT("Description?")); |
| 663 | |
| 664 | if ((int)(*srate) == AudioThread::deviceSampleRate[outputDevice.first]) { |
| 665 | itm->Check(true); |
| 666 | } |
| 667 | audioSampleRateMenuItems[menu_id + j] = itm; |
| 668 | |
| 669 | j++; |
| 670 | } |
| 671 | } |
| 672 | return pMenu; |
| 673 | } |
| 674 | |
| 675 | MeterCanvas *AppFrame::makeWaterfallSpeedMeter(wxWindow *parent, const wxGLAttributes &attribList) { |
| 676 | auto *pCanvas = new MeterCanvas(parent, attribList); |
nothing calls this directly
no test coverage detected