MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / OnApply

Method OnApply

Source/ConfigSound.cpp:124–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124BOOL CConfigSound::OnApply()
125{
126 CComboBox *pDevices = static_cast<CComboBox*>(GetDlgItem(IDC_DEVICES));
127 CComboBox *pSampleRate = static_cast<CComboBox*>(GetDlgItem(IDC_SAMPLE_RATE));
128 CComboBox *pSampleSize = static_cast<CComboBox*>(GetDlgItem(IDC_SAMPLE_SIZE));
129 CSliderCtrl *pBufSlider = static_cast<CSliderCtrl*>(GetDlgItem(IDC_BUF_LENGTH));
130
131 auto *pSettings = FTEnv.GetSettings(); // // //
132
133 switch (pSampleRate->GetCurSel()) {
134 case 0: pSettings->Sound.iSampleRate = 11025; break;
135 case 1: pSettings->Sound.iSampleRate = 22050; break;
136 case 2: pSettings->Sound.iSampleRate = 44100; break;
137 case 3: pSettings->Sound.iSampleRate = 48000; break;
138 case 4: pSettings->Sound.iSampleRate = 96000; break;
139 }
140
141 switch (pSampleSize->GetCurSel()) {
142 case 0: pSettings->Sound.iSampleSize = 16; break;
143 case 1: pSettings->Sound.iSampleSize = 8; break;
144 }
145
146 pSettings->Sound.iBufferLength = pBufSlider->GetPos();
147
148 pSettings->Sound.iBassFilter = static_cast<CSliderCtrl*>(GetDlgItem(IDC_BASS_FREQ))->GetPos();
149 pSettings->Sound.iTrebleFilter = static_cast<CSliderCtrl*>(GetDlgItem(IDC_TREBLE_FREQ))->GetPos();
150 pSettings->Sound.iTrebleDamping = static_cast<CSliderCtrl*>(GetDlgItem(IDC_TREBLE_DAMP))->GetPos();
151 pSettings->Sound.iMixVolume = static_cast<CSliderCtrl*>(GetDlgItem(IDC_VOLUME))->GetPos();
152
153 pSettings->Sound.iDevice = pDevices->GetCurSel();
154
155 FTEnv.GetSoundGenerator()->LoadSoundConfig(); // // //
156
157 return CPropertyPage::OnApply();
158}
159
160void CConfigSound::OnCbnSelchangeSampleRate()
161{

Callers

nothing calls this directly

Calls 3

LoadSoundConfigMethod · 0.80
GetSettingsMethod · 0.45
GetSoundGeneratorMethod · 0.45

Tested by

no test coverage detected