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

Method Validate

src/prefs/SpectrumPrefs.cpp:330–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330bool SpectrumPrefs::Validate()
331{
332 // Do checking for whole numbers
333
334 // ToDo: use wxIntegerValidator<unsigned> when available
335
336 long maxFreq;
337 if (!mMaxFreq->GetValue().ToLong(&maxFreq)) {
338 AudacityMessageBox( XO("The maximum frequency must be an integer") );
339 return false;
340 }
341
342 long minFreq;
343 if (!mMinFreq->GetValue().ToLong(&minFreq)) {
344 AudacityMessageBox( XO("The minimum frequency must be an integer") );
345 return false;
346 }
347
348 long gain;
349 if (!mGain->GetValue().ToLong(&gain)) {
350 AudacityMessageBox( XO("The gain must be an integer") );
351 return false;
352 }
353
354 long range;
355 if (!mRange->GetValue().ToLong(&range)) {
356 AudacityMessageBox( XO("The range must be a positive integer") );
357 return false;
358 }
359
360 long frequencygain;
361 if (!mFrequencyGain->GetValue().ToLong(&frequencygain)) {
362 AudacityMessageBox( XO("The frequency gain must be an integer") );
363 return false;
364 }
365
366#ifdef EXPERIMENTAL_FIND_NOTES
367 long findNotesMinA;
368 if (!mFindNotesMinA->GetValue().ToLong(&findNotesMinA)) {
369 AudacityMessageBox( XO("The minimum amplitude (dB) must be an integer") );
370 return false;
371 }
372
373 long findNotesN;
374 if (!mFindNotesN->GetValue().ToLong(&findNotesN)) {
375 AudacityMessageBox( XO("The maximum number of notes must be an integer") );
376 return false;
377 }
378 if (findNotesN < 1 || findNotesN > 128) {
379 AudacityMessageBox( XO(
380"The maximum number of notes must be in the range 1..128") );
381 return false;
382 }
383#endif //EXPERIMENTAL_FIND_NOTES
384
385 ShuttleGui S(this, eIsSavingToPrefs);
386 PopulateOrExchange(S);
387

Callers

nothing calls this directly

Calls 5

AudacityMessageBoxFunction · 0.85
PopulateOrExchangeFunction · 0.50
GetValueMethod · 0.45

Tested by

no test coverage detected