Skip to content
Snippets Groups Projects
Commit 25dbcaa2 authored by q3k's avatar q3k Committed by q3k
Browse files

py/shoegaze: use InputController

parent 41b7dd6d
No related branches found
No related tags found
1 merge request!88py: re-introduce os/app button naming, pop views on os button press
...@@ -80,14 +80,10 @@ class ShoegazeApp(Application): ...@@ -80,14 +80,10 @@ class ShoegazeApp(Application):
self.main_mixer.signals.gain = 2000 self.main_mixer.signals.gain = 2000
self.main_lp.signals.reso = 2000 self.main_lp.signals.reso = 2000
self.cp_prev = captouch.read()
self._set_chord(3) self._set_chord(3)
self.prev_captouch = [0] * 10
self._tilt_bias = 0.0 self._tilt_bias = 0.0
self._detune_prev = 0.0 self._detune_prev = 0.0
self._git_string_tuning = [0] * 4 self._git_string_tuning = [0] * 4
self._button_prev = 0
self._update_connections() self._update_connections()
self._spinny = -0.5 self._spinny = -0.5
self._gaze_counter = 0 self._gaze_counter = 0
...@@ -202,24 +198,22 @@ class ShoegazeApp(Application): ...@@ -202,24 +198,22 @@ class ShoegazeApp(Application):
detune = (tilt - self._tilt_bias) * 0.5 + self._detune_prev * 0.5 detune = (tilt - self._tilt_bias) * 0.5 + self._detune_prev * 0.5
self._detune_prev = detune self._detune_prev = detune
cts = captouch.read() buttons = self.input.buttons
button = ins.left_button petals = self.input.captouch.petals
if button != self._button_prev: if buttons.app.right.pressed:
if button == 1: self.delay_toggle()
self.delay_toggle() if buttons.app.left.pressed:
if button == -1: pass
pass # self.fuzz_toggle()
# self.fuzz_toggle()
self._button_prev = button
for i in range(1, 10, 2): for i in range(1, 10, 2):
if cts.petals[i].pressed and (not self.cp_prev.petals[i].pressed): if petals[i].whole.pressed:
k = int((i - 1) / 2) k = int((i - 1) / 2)
self._set_chord(k) self._set_chord(k)
for i in range(2, 10, 2): for i in range(2, 10, 2):
k = int(i / 2) - 1 k = int(i / 2) - 1
if cts.petals[i].pressed and (not self.cp_prev.petals[i].pressed): if petals[i].whole.pressed:
self._git_string_tuning[k] = self.chord[k] - 12 self._git_string_tuning[k] = self.chord[k] - 12
self.git_strings[k].signals.pitch.tone = self._git_string_tuning[k] self.git_strings[k].signals.pitch.tone = self._git_string_tuning[k]
self.git_strings[k].decay = 3000 self.git_strings[k].decay = 3000
...@@ -227,12 +221,10 @@ class ShoegazeApp(Application): ...@@ -227,12 +221,10 @@ class ShoegazeApp(Application):
self.git_strings[k].signals.pitch.tone = self._git_string_tuning[k] + detune self.git_strings[k].signals.pitch.tone = self._git_string_tuning[k] + detune
if cts.petals[0].pressed and (not self.cp_prev.petals[0].pressed): if petals[0].whole.pressed:
self.bass_string.signals.pitch.tone = self.chord[0] - 24 self.bass_string.signals.pitch.tone = self.chord[0] - 24
self.bass_string.decay = 1000 self.bass_string.decay = 1000
self.bass_string.signals.trigger.start() self.bass_string.signals.trigger.start()
self.cp_prev = cts
def __del__(self) -> None: def __del__(self) -> None:
self.blm.clear() self.blm.clear()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment