gen_values: precalculate sin() param factor

ironpython
András Veres-Szentkirályi 2013-07-02 11:46:01 +02:00
rodzic 105fa7b051
commit dcb194a5f0
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -75,13 +75,13 @@ class SSTV(object):
spms = self.samples_per_sec / 1000
param = 0
samples = 0
factor = 2 * pi / self.samples_per_sec
for freq, msec in self.gen_freq_bits():
offset = param
samples += spms * msec
tx = floor(samples)
for sample in xrange(int(tx)):
t = sample / self.samples_per_sec
param = t * freq * 2 * pi + offset
param = sample * freq * factor + offset
yield sin(param)
samples -= tx