B-Netz, NMT: Improved check for minimum required sample rate

This commit is contained in:
Andreas Eversberg
2017-01-29 07:27:08 +01:00
parent 7e45f556ce
commit f72c53757d
2 changed files with 11 additions and 7 deletions

View File

@@ -83,8 +83,12 @@ int dsp_init_sender(bnetz_t *bnetz)
sample_t *spl;
int i;
if ((bnetz->sender.samplerate % 1000)) {
PDEBUG(DDSP, DEBUG_ERROR, "Samples rate must be a multiple of 1000 bits per second.\n");
if ((bnetz->sender.samplerate % (int)(1.0 / (double)BIT_DURATION))) {
PDEBUG(DDSP, DEBUG_ERROR, "Samples rate must be a multiple of %d bits per second.\n", (int)(1.0 / (double)BIT_DURATION));
return -EINVAL;
}
if ((bnetz->sender.samplerate % (int)(1.0 / (double)FILTER_STEP))) {
PDEBUG(DDSP, DEBUG_ERROR, "Samples rate must be a multiple of %d bits per second.\n", (int)(1.0 / (double)FILTER_STEP));
return -EINVAL;
}