add strobe
This commit is contained in:
parent
5730142d67
commit
fb2b888193
1 changed files with 14 additions and 3 deletions
17
beamshow.py
17
beamshow.py
|
@ -146,6 +146,7 @@ class Beamshow:
|
||||||
framecounter = 0
|
framecounter = 0
|
||||||
blackout = False
|
blackout = False
|
||||||
single_random = False
|
single_random = False
|
||||||
|
strobe = False
|
||||||
fps_slidewindow = []
|
fps_slidewindow = []
|
||||||
frames_per_beat = 0
|
frames_per_beat = 0
|
||||||
while True:
|
while True:
|
||||||
|
@ -155,10 +156,10 @@ class Beamshow:
|
||||||
if is_beat:
|
if is_beat:
|
||||||
if self.beat_skip_counter > 0:
|
if self.beat_skip_counter > 0:
|
||||||
is_beat = False
|
is_beat = False
|
||||||
print(" skip")
|
# print(" skip")
|
||||||
self.beat_skip_counter -= 1
|
self.beat_skip_counter -= 1
|
||||||
else:
|
else:
|
||||||
print("beat")
|
# print("beat")
|
||||||
self.beat_skip_counter = self.beat_factor - 1
|
self.beat_skip_counter = self.beat_factor - 1
|
||||||
|
|
||||||
fps_mean = (
|
fps_mean = (
|
||||||
|
@ -210,12 +211,17 @@ class Beamshow:
|
||||||
self.beat_skip_counter = 0
|
self.beat_skip_counter = 0
|
||||||
elif event.key == pg.K_PAGEUP:
|
elif event.key == pg.K_PAGEUP:
|
||||||
self.beat_factor = (
|
self.beat_factor = (
|
||||||
self.beat_factor / 2 if self.beat_factor > 1 else 1
|
self.beat_factor // 2 if self.beat_factor > 1 else 1
|
||||||
)
|
)
|
||||||
print(f"Trigger on every {self.beat_factor} beat")
|
print(f"Trigger on every {self.beat_factor} beat")
|
||||||
elif event.key == pg.K_PAGEDOWN:
|
elif event.key == pg.K_PAGEDOWN:
|
||||||
self.beat_factor = self.beat_factor * 2
|
self.beat_factor = self.beat_factor * 2
|
||||||
print(f"Trigger on every {self.beat_factor} beat")
|
print(f"Trigger on every {self.beat_factor} beat")
|
||||||
|
elif event.key == pg.K_RETURN:
|
||||||
|
strobe = True
|
||||||
|
elif event.type == pg.KEYUP:
|
||||||
|
if event.key == pg.K_RETURN:
|
||||||
|
strobe = False
|
||||||
|
|
||||||
if reinitialize:
|
if reinitialize:
|
||||||
self.window, self.background = self.initialize()
|
self.window, self.background = self.initialize()
|
||||||
|
@ -225,6 +231,11 @@ class Beamshow:
|
||||||
loop = self.render_loop_normal()
|
loop = self.render_loop_normal()
|
||||||
next(loop)
|
next(loop)
|
||||||
|
|
||||||
|
if strobe:
|
||||||
|
self.window.fill(
|
||||||
|
Colors.White if (framecounter % 4 == 0) else Colors.Black
|
||||||
|
)
|
||||||
|
|
||||||
if blackout:
|
if blackout:
|
||||||
self.window.fill(Colors.Black)
|
self.window.fill(Colors.Black)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue