aboutsummaryrefslogtreecommitdiffstats
path: root/src/bnetz
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2017-01-29 07:27:08 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2017-02-18 21:01:15 +0100
commitf72c53757d4ce30c37ecefda825f21f42c60b05e (patch)
tree4f5ebcf7494e1a12a90e325781ab857e86677f7a /src/bnetz
parent7e45f556cec493c3c77fcb6400d8ae211faf2220 (diff)
B-Netz, NMT: Improved check for minimum required sample rate
Diffstat (limited to 'src/bnetz')
-rw-r--r--src/bnetz/dsp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/bnetz/dsp.c b/src/bnetz/dsp.c
index 70b4649..3d1e127 100644
--- a/src/bnetz/dsp.c
+++ b/src/bnetz/dsp.c
@@ -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;
}