From b6ab9fcbec899e345d81554d60111e95cf9ce466 Mon Sep 17 00:00:00 2001
From: Grissess <grissess@nexusg.org>
Date: Wed, 20 Apr 2016 04:13:13 -0400
Subject: Bugfixes, graphics, and new generators

---
 client.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'client.py')

diff --git a/client.py b/client.py
index 87f4437..91ef663 100644
--- a/client.py
+++ b/client.py
@@ -78,7 +78,7 @@ def pygame_notes():
         SAMP_WIDTH = options.samp_width
     BGR_WIDTH = DISP_WIDTH / 2
     if options.bgr_width > 0:
-        NGR_WIDTH = options.bgr_width
+        BGR_WIDTH = options.bgr_width
     HEIGHT = DISP_HEIGHT
     if options.height > 0:
         HEIGHT = options.height
@@ -214,6 +214,14 @@ class harmonic(object):
     def __call__(self, theta):
         return max(-1, min(1, sum([amp*self.gen((i+1)*theta % (2*math.pi)) for i, amp in enumerate(self.spectrum)])))
 
+@generator('General harmonics generator (adds arbitrary overtones)', '(<generator>, <factor of f>, <amplitude>, <factor>, <amplitude>, ...)')
+class genharmonic(object):
+    def __init__(self, gen, *harmonics):
+        self.gen = gen
+        self.harmonics = zip(harmonics[::2], harmonics[1::2])
+    def __call__(self, theta):
+        return max(-1, min(1, sum([amp * self.gen(i * theta % (2*math.pi)) for i, amp in self.harmonics])))
+
 @generator('Mix generator', '(<generator>[, <amp>], [<generator>[, <amp>], [...]])')
 class mixer(object):
     def __init__(self, *specs):
-- 
cgit v1.2.3-70-g09d2