mirror of
https://github.com/romanz/amodem.git
synced 2026-05-10 05:17:38 +08:00
config: validate settings
This commit is contained in:
@@ -9,7 +9,6 @@ class Configuration(object):
|
|||||||
|
|
||||||
# audio config
|
# audio config
|
||||||
bits_per_sample = 16
|
bits_per_sample = 16
|
||||||
sample_size = bits_per_sample // 8
|
|
||||||
latency = 0.1
|
latency = 0.1
|
||||||
|
|
||||||
# sender config
|
# sender config
|
||||||
@@ -22,10 +21,14 @@ class Configuration(object):
|
|||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.__dict__.update(**kwargs)
|
self.__dict__.update(**kwargs)
|
||||||
|
|
||||||
|
self.sample_size = self.bits_per_sample // 8
|
||||||
|
assert self.sample_size * 8 == self.bits_per_sample
|
||||||
|
|
||||||
self.Ts = 1.0 / self.Fs
|
self.Ts = 1.0 / self.Fs
|
||||||
self.Fsym = 1 / self.Tsym
|
self.Fsym = 1 / self.Tsym
|
||||||
self.Nsym = int(self.Tsym / self.Ts)
|
self.Nsym = int(self.Tsym / self.Ts)
|
||||||
self.baud = int(1.0 / self.Tsym)
|
self.baud = int(1.0 / self.Tsym)
|
||||||
|
assert self.baud * self.Tsym == 1
|
||||||
|
|
||||||
if len(self.frequencies) != 1:
|
if len(self.frequencies) != 1:
|
||||||
first, last = self.frequencies
|
first, last = self.frequencies
|
||||||
|
|||||||
Reference in New Issue
Block a user