Compare commits

..

22 Commits

Author SHA1 Message Date
bed8cae617 display selected athmo and disappear after playback ends 2025-09-01 21:41:34 +02:00
0448355401 changed the display style of the selected beat 2025-09-01 20:31:01 +02:00
ce9b7c39ec change the actual controller fx_mode when tapping the lozenge_buttons 2025-09-01 11:47:16 +02:00
5fe9d7cada made gui compatible with the changes of the controller 2025-08-30 21:56:09 +02:00
ca861f1530 added right-side-knobs and mode-select buttons 2025-08-30 20:25:40 +02:00
468e7974be Merge branch 'main' of https://code.w4d.dev/sallar/SantoscopeUI 2025-08-28 11:07:44 +02:00
a507916f1c optimized some path calculation code 2025-08-18 18:04:21 +02:00
306c8755eb added an option for changing the arrangement according to whether it's a left or right side knobs module 2025-08-18 17:53:56 +02:00
b176c11cc1 made gui compatible with the system 2025-08-07 12:04:51 +02:00
1d247fc0ed selected track and clip gets displayed at the bottom of the UI 2025-08-03 20:09:55 +02:00
46c08009de adjusted item_selection and created a module 'beatplayer' 2025-08-03 19:25:18 +02:00
9f9f667a86 extracted the ItemSelection from athmos and created a parent class 2025-08-03 18:29:25 +02:00
f55522f03c changed the apparence of athmos.py and added max_width property 2025-08-03 18:01:18 +02:00
8265ba0f0a changed GuiMain in order to make it testable with laptop 2025-08-03 17:58:42 +02:00
6dc72353d7 unknown commit 2025-08-03 13:04:12 +02:00
4fb5a899d4 bugfixed last commit 2025-04-08 18:50:06 +02:00
b5b792b449 added a label for the loop input mode 2025-04-08 18:41:46 +02:00
8f9e5257f6 athmos display been bugfixed and can now be switched by the knobs display 2025-04-08 16:03:58 +02:00
bfd5b41e93 bugfix: athmo should not blit at all, when showlist is false 2025-04-05 16:05:47 +02:00
2bb807aca9 the athmo list display has been bug-fixed and a opacity gradient has been added to the list 2025-04-02 23:42:32 +02:00
4ed2a6d3aa the display of athmos has been implemented 2025-04-02 22:59:01 +02:00
bda08dab84 added a module for displaying athmos 2025-04-02 21:27:14 +02:00
13 changed files with 415 additions and 76 deletions

0
.gitignore vendored Executable file → Normal file
View File

26
athmos.py Executable file
View File

@ -0,0 +1,26 @@
from .fonts import *
from .colors import *
from .item_selection import ItemSelection
import pygame
class Athmos(ItemSelection):
def __init__(self, screen):
self.screen = screen
self.show_list = True
self.max_name_width = 350
super().__init__(self.max_name_width)
self.current_duration = 0
self.time_started = 0
def set_filenames(self,filenames):
super().set_items(filenames)
def get_name_by_index(self, index):
return self.items[index]
def update(self):
if self.show_list:
super().update()
self.screen.blit(self.surface, ((self.screen.get_width()-self.max_name_width)/2,
(self.screen.get_height() - self.surface.get_height())/2))

40
beatplayer.py Normal file
View File

@ -0,0 +1,40 @@
from .item_selection import ItemSelection
import pygame
from .colors import *
from .fonts import *
class BeatPlayer:
def __init__(self, screen):
self.screen = screen
self.max_name_width = 200
self.clip_selection = ItemSelection(self.max_name_width)
self.track_selection = ItemSelection(self.max_name_width)
self.show_selection = False
def set_clip_names(self, clips):
self.clip_selection.set_items(clips)
def set_track_names(self, tracks):
self.track_selection.set_items(tracks)
def update(self):
if self.show_selection:
self.track_selection.update()
self.clip_selection.update()
self.screen.blit(self.track_selection.surface, ((self.screen.get_width()/4),
(self.screen.get_height() - self.track_selection.surface.get_height())/2))
self.screen.blit(self.clip_selection.surface, ((self.screen.get_width()/4 + self.max_name_width) + 100,
(self.screen.get_height() - self.clip_selection.surface.get_height())/2))
else:
selected_track = self.track_selection.get_selected_item()
selected_clip = self.clip_selection.get_selected_item()
if len(selected_track) > 15: selected_track = selected_track[0:13] + '...'
if len(selected_clip) > 30: selected_clip = selected_clip[0:28] + '...'
track_surface = font_helvetica16.render(f"{selected_track}",
False, color_primary_dark)
clip_surface = font_helvetica16.render(f"/ {selected_clip}",
False, color_primary_dark)
self.screen.blit(clip_surface, (self.screen.get_width()/2, 15))
self.screen.blit(track_surface, (self.screen.get_width()/2-track_surface.get_width()-10, 15))

0
binary_button.py Executable file → Normal file
View File

0
circle_button.py Executable file → Normal file
View File

0
colors.py Executable file → Normal file
View File

34
exit Normal file
View File

@ -0,0 +1,34 @@
usage: git diff [<options>] [<commit>] [--] [<path>...]
or: git diff [<options>] --cached [--merge-base] [<commit>] [--] [<path>...]
or: git diff [<options>] [--merge-base] <commit> [<commit>...] <commit> [--] [<path>...]
or: git diff [<options>] <commit>...<commit> [--] [<path>...]
or: git diff [<options>] <blob> <blob>
or: git diff [<options>] --no-index [--] <path> <path>
common diff options:
-z output diff-raw with lines terminated with NUL.
-p output patch format.
-u synonym for -p.
--patch-with-raw
output both a patch and the diff-raw format.
--stat show diffstat instead of patch.
--numstat show numeric diffstat instead of patch.
--patch-with-stat
output a patch and prepend its diffstat.
--name-only show only names of changed files.
--name-status show names and status of changed files.
--full-index show full object name on index lines.
--abbrev=<n> abbreviate object names in diff-tree header and diff-raw.
-R swap input file pairs.
-B detect complete rewrites.
-M detect renames.
-C detect copies.
--find-copies-harder
try unchanged files as candidate for copy detection.
-l<n> limit rename attempts up to <n> paths.
-O<file> reorder diffs according to the <file>.
-S<string> find filepair whose only one side contains the string.
--pickaxe-all
show all files diff when -S is used and hit is found.
-a --text treat all files as text.

0
fonts.py Executable file → Normal file
View File

52
item_selection.py Normal file
View File

@ -0,0 +1,52 @@
from .fonts import *
from .colors import *
import pygame
import math
class ItemSelection:
def __init__(self, max_item_width, max_display_count = 9):
self.index = 0
self.items = []
self.surface = pygame.Surface((0,0), pygame.SRCALPHA)
self.max_item_width = max_item_width
self.max_display_count = max_display_count
self.selected_item_srf = None
def set_items(self, items):
self.items = items
self.surface = pygame.Surface(
(self.max_item_width+50, self.get_display_count()*40), pygame.SRCALPHA)
def get_display_count(self):
return min(self.max_display_count, len(self.items))
def get_count(self):
return len(self.items)
def get_selected_item(self):
return self.items[self.index]
def update(self):
self.surface.fill("black")
for i in range(self.get_display_count()):
text = self.items[(i+self.index-math.floor(self.get_display_count()/2))%len(self.items)]
if len(text)> math.floor(self.max_item_width/10):
text = text[0:math.floor(self.max_item_width/10)-2]
text += '...'
#text = self.items[i]
if i == math.floor(self.get_display_count()/2):
#if i == self.index:
text_surface = font_helvetica16.render(text, False, color_primary_light)
self.selected_item_srf = text_surface
else:
text_surface = font_helvetica16.render(text, False, color_primary)
opacity = -15 + math.floor((i+1) * 2 * 255 / self.max_display_count
if i < self.max_display_count/2
else (self.max_display_count-i) * 2 * 255 / self.max_display_count)
text_surface.set_alpha(opacity)
#if text_surface.get_width() > self.max_item_width: self.max_item_width = text_surface.get_width()
self.surface.blit(text_surface, ((10, self.surface.get_height()/self.get_display_count()*i)))
pygame.draw.rect(self.surface, color_primary_light,
(0, self.surface.get_height()/2-25, self.max_item_width+20, 40), 2)

3
knob.py Executable file → Normal file
View File

@ -37,6 +37,9 @@ class Knob:
def get_position(self):
return self.position
def get_index(self, knobs):
return knobs.index(self)
def __eq__(self, other):
if other is None: return False

80
knobs.py Executable file → Normal file
View File

@ -6,7 +6,7 @@ import random
class Knobs:
def __init__(self, gui):
def __init__(self, gui, knob_names, is_left_side=True):
self.gui = gui
self.knobs_surface = pygame.Surface((gui.screenW, gui.screenH), pygame.SRCALPHA)
@ -15,17 +15,9 @@ class Knobs:
self.fade_speed = 5
self.fade_in = False
self.fade_out = False
self.knob_names = knob_names
knob_names = [
'Delay Time',
'Delay Vol',
'Reverb Wet',
'Reverb Size',
'Filter Freq',
'Distortion',
'Detune',
'Gain'
]
self.is_left_side = is_left_side
# Create and position the knobs
self.knobs_radius = self.gui.screenW / 25
@ -38,7 +30,7 @@ class Knobs:
for i in range(len(knob_names)):
self.knobs.append(Knob(self, knob_names[i], self.knobs_radius, (x, y), 0))
y += self.knobs_radius + knobs_spacing
if i == 3 or i == 6:
if i == 3 or (self.is_left_side and i == 6) or (not self.is_left_side and i == 0):
x += self.knobs_radius + knobs_spacing
y = knobs_y
self.label_vanish_parameter = 0
@ -90,24 +82,39 @@ class Knobs:
def calculate_label_path(self, knob, label_x):
if len(knob.label_path) == 0:
knob.label_path.append(knob.get_position())
if (knob == self.knobs[0] or knob == self.knobs[1] or
knob == self.knobs[4] or knob == self.knobs[5]):
x = knob.get_position()[0] + self.knobs_radius * 1.5
y = knob.get_position()[1] + self.knobs_radius * 1.5
knob.label_path.append((x, y))
elif (knob == self.knobs[2] or knob == self.knobs[3] or knob == self.knobs[6]):
x = knob.get_position()[0] + self.knobs_radius * 1.5
y = knob.get_position()[1] - self.knobs_radius * 1.5
knob.label_path.append((x, y))
elif (knob == self.knobs[7]):
x = knob.get_position()[0] - self.knobs_radius * 1.5
y = knob.get_position()[1] + self.knobs_radius * 1.5
knob_index = knob.get_index(self.knobs)
if self.is_left_side:
if knob_index in [0, 1, 4, 5] :
x = knob.get_position()[0] + self.knobs_radius * 1.5
y = knob.get_position()[1] + self.knobs_radius * 1.5
elif knob_index in [2, 3, 6]:
x = knob.get_position()[0] + self.knobs_radius * 1.5
y = knob.get_position()[1] - self.knobs_radius * 1.5
else: # knob 7
x = knob.get_position()[0] - self.knobs_radius * 1.5
y = knob.get_position()[1] + self.knobs_radius * 1.5
knob.label_path.append((x, y))
if (knob == self.knobs[0] or knob == self.knobs[3]):
knob.label_path.append((self.knobs[0].get_position()[0] + self.knobs_radius * 1.5, self.gui.screenH/2))
elif (knob == self.knobs[4] or knob == self.knobs[6] or knob == self.knobs[7]):
knob.label_path.append((self.knobs[4].get_position()[0] + self.knobs_radius * 1.5, self.gui.screenH/2))
if (knob == self.knobs[0] or knob == self.knobs[3]):
knob.label_path.append((knob.get_position()[0] + self.knobs_radius * 1.5, self.gui.screenH/2))
elif (knob == self.knobs[4] or knob == self.knobs[7]):
knob.label_path.append((self.knobs[4].get_position()[0] + self.knobs_radius * 1.5, self.gui.screenH/2))
else:
if knob_index in [1, 2, 4, 5]:
x = knob.get_position()[0] + self.knobs_radius * 1.5
y = knob.get_position()[1] + self.knobs_radius * 1.5
elif knob_index in [3, 6, 7]:
x = knob.get_position()[0] + self.knobs_radius * 1.5
y = knob.get_position()[1] - self.knobs_radius * 1.5
else: # knob 0
x = knob.get_position()[0] + self.knobs_radius * 1.5
y = knob.get_position()[1] + self.knobs_radius * 1.5
knob.label_path.append((x, y))
if (knob == self.knobs[0] or knob == self.knobs[1]):
knob.label_path.append((knob.get_position()[0] + self.knobs_radius * 1.5, self.gui.screenH/2))
elif (knob == self.knobs[4] or knob == self.knobs[7]):
knob.label_path.append((knob.get_position()[0] + self.knobs_radius * 1.5, self.gui.screenH/2))
knob.label_path.append((label_x - 10, self.gui.screenH/2))
@ -142,11 +149,12 @@ class Knobs:
self.knobs[index].set_value(value)
def display(self):
if self.fade_in and self.opacity < 255: self.opacity += self.fade_speed
if self.fade_out and self.opacity > 0: self.opacity -= self.fade_speed
self.knobs_surface = pygame.Surface((self.gui.screenW, self.gui.screenH), pygame.SRCALPHA)
for knob in self.knobs:
if knob.focused or knob.vanish_label_path: self.display_label(knob)
knob.display(self.knobs_surface)
self.gui.screen.blit(self.knobs_surface, (0,0))
if self.gui.show_knobs:
if self.fade_in and self.opacity < 255: self.opacity += self.fade_speed
if self.fade_out and self.opacity > 0: self.opacity -= self.fade_speed
self.knobs_surface = pygame.Surface((self.gui.screenW, self.gui.screenH), pygame.SRCALPHA)
for knob in self.knobs:
if knob.focused or knob.vanish_label_path: self.display_label(knob)
knob.display(self.knobs_surface)
self.gui.screen.blit(self.knobs_surface, (0,0))

8
lozenge_button.py Executable file → Normal file
View File

@ -5,7 +5,7 @@ from .fonts import *
class LozengeButton:
def __init__(self, gui, name, position, radius_x, radius_y):
def __init__(self, gui, name, position, radius_x, radius_y, side):
self.gui = gui
self.screen = gui.screen
self.name = name
@ -13,6 +13,7 @@ class LozengeButton:
self.y = position[1]
self.radius_x = radius_x
self.radius_y = radius_y
self.side = side
self.focused = False
def display(self):
@ -21,12 +22,13 @@ class LozengeButton:
pos = pygame.mouse.get_pos()
if math.sqrt(math.pow(pos[0] - self.x, 2) + math.pow(pos[1] - self.y, 2)) < self.radius_y:
self.focused = True
self.gui.set_fx_mode_by_name(self.name)
self.gui.set_fx_mode_by_name(self.side, self.name)
self.gui.set_controller_fx_mode(self.side, self.name)
if self.focused:
w = 0
fx_mode_label = font_helvetica16.render(self.name, False, color_primary_light)
self.screen.blit(fx_mode_label, (self.x + 20, self.y - 8))
self.screen.blit(fx_mode_label, (self.x + (20 if self.side == 0 else -20-fx_mode_label.get_width()), self.y - 8))
else:
w = 2
fx_mode_label = font_helvetica16.render(str(self.name)[0:1], False, color_primary_light)

248
main.py
View File

@ -5,10 +5,13 @@ from .knobs import Knobs
from .lozenge_button import LozengeButton
from .binary_button import BinaryButton
from .circle_button import *
from .athmos import Athmos
from .beatplayer import BeatPlayer
class GuiMain:
def __init__(self):
def __init__(self, controller):
self.controller = controller
# pygame setup
pygame.init()
pygame.display.set_caption("SantoscopeUI")
@ -20,68 +23,192 @@ class GuiMain:
self.label_surface = pygame.Surface((self.screenW, self.screenH), pygame.SRCALPHA)
self.fx_mode_labels = [
'Strings',
'Beat',
'L-Loop',
'R-Loop',
'Jack',
'Athmo'
[
'Strings',
'L-Loop',
'R-Loop',
'Jack',
'Athmo'
],
[
'Mixer',
'Beat'
]
]
left_knob_names = [
'Delay Time',
'Delay Vol',
'Reverb Wet',
'Reverb Size',
'Filter Freq',
'Distortion',
'Detune',
'Gain'
]
mixer_knob_names = [
'Jack Vol',
'Athmo Vol',
'Beat speed',
'L-loop Vol',
'-unassigned-',
'Beat Vol',
'R-loop Vol',
'Master Vol'
]
# Create and position the fx_mode buttons
self.fx_mode_buttons = []
self.fx_mode_buttons = [[],[]]
self.fx_mode = 0
self.fx_mode = [0, 0]
for i in range(len(self.fx_mode_labels)):
for i in range(len(self.fx_mode_labels[0])):
x = self.screenW * 2.5 / 19
y = i * self.screenH / 7.5 + 45
r_x = self.screenW * 0.35 / 19
r_y = (self.screenH-20) / 16
self.fx_mode_buttons.append(
LozengeButton(self, self.fx_mode_labels[i], (x,y), r_x, r_y)
self.fx_mode_buttons[0].append(
LozengeButton(self, self.fx_mode_labels[0][i], (x,y), r_x, r_y, 0)
)
for i in range(len(self.fx_mode_labels[1])):
x = self.screenW - 30
y = i * self.screenH / 7.5 + 90
r_x = self.screenW * 0.35 / 19
r_y = (self.screenH-20) / 16
self.fx_mode_buttons[1].append(
LozengeButton(self, self.fx_mode_labels[1][i], (x,y), r_x, r_y, 1)
)
self.knobs = []
for i in range(len(self.fx_mode_labels)):
self.knobs.append(Knobs(self))
self.knobs = [[], []]
for i in range(len(self.fx_mode_labels[0])):
self.knobs[0].append(Knobs(self, left_knob_names))
for i in range(len(self.fx_mode_labels[1])):
self.knobs[1].append(Knobs(self, left_knob_names if i==1 else mixer_knob_names, is_left_side=False))
self.set_fx_mode(self.fx_mode)
self.set_fx_mode(0, self.fx_mode[0])
self.set_fx_mode(1, self.fx_mode[1])
self.show_knobs = True
self.knobs_display_side = 0
self.mute_button = BinaryButton(
self.screen,
(20, self.fx_mode_buttons[0].y-20),
(20, self.fx_mode_buttons[0][0].y-20),
(40, 40), 'M',
False)
self.beat_button = BeatButton(self, (40, self.fx_mode_buttons[1].y), 20)
self.rloop_button = LoopButton(self, (40, self.fx_mode_buttons[2].y), 20)
self.lloop_button = LoopButton(self, (40, self.fx_mode_buttons[3].y), 20)
self.beat_button = BeatButton(self, (40, self.fx_mode_buttons[0][1].y), 20)
self.rloop_button = LoopButton(self, (40, self.fx_mode_buttons[0][2].y), 20)
self.lloop_button = LoopButton(self, (40, self.fx_mode_buttons[0][3].y), 20)
self.rec_button = BinaryButton(
self.screen,
(self.screenW-70, self.screenH-40),
(self.screenW-70, 15),
(60, 30),
"REC",
False
)
self.loop_input_mode = None
self.set_loop_input_mode(0)
self.beatplayer = BeatPlayer(self.screen)
self.athmos = Athmos(self.screen)
self.athmos.show_list = False
fnames = [
"01_7Qp3xL8gK2tA5mR9eZ1vC4bN6sH0jF",
"02_yP5cT8kL3wR0vX6mN9bQ2fZ4hJ7dS1",
"03_3aB7eF2gH9jK5lM1nP6qR0sT8uV4B7eF2gH9jK5lM1nP6qR0sT8uV4wX",
"04_6mV0cX8zL5jH7gF2dS9aP1oI3uY4tR",
"05_2pQ8oR3iK6jL1fH7gK9wL0q3xZ4jL1fH7gK9wL0q3xZ4rE5",
"06_9eZ1vC4bN6sH0jF7Qp3xL8gK2tA5mR",
"07_0vX6mN9bQ2fZ4hJ7dS1yP5cT8kL3wR",
"08_1nP6qR0sT8uV4wX3aB7eF2gH9jK5lM",
"09_5jH7gF2dS9aP1oI3uY4tR6mV0cX8zL",
"10_6jL1fH7gK9wL0q3xZ4rE5pQ8oR3iK2",
"11_0jF7Qp3xL8gK2tA5mR9eZ1vC4bN6sH",
"12_4hJ7dS1yP5cT8kL3wR0vX6mN9bQ2fZ",
"13_9jK5lM1nP6qR0sT8uV4wX3aB7eF2gH"
]
#self.beatplayer.set_clip_names(fnames[0:5])
#self.beatplayer.set_track_names(fnames[0:9])
#self.set_athmo_filenames(fnames)
self.selected_athmo_srf = None
self.clock = pygame.time.Clock()
self.running = True
def set_knob_value(self, index, value):
self.knobs[self.fx_mode].set_value(index, value)
def set_knob_value(self, side, index, value):
self.knobs_display_side = side
self.knobs[side][self.fx_mode[side]].set_value(index, value)
def set_fx_mode(self, i):
self.set_fx_mode_by_name(self.fx_mode_labels[i])
def set_fx_mode(self, side, i):
self.set_fx_mode_by_name(side, self.fx_mode_labels[side][i])
def set_fx_mode_by_name(self, mode):
self.knobs[self.fx_mode].opacity = 0
self.fx_mode = self.fx_mode_labels.index(mode)
self.knobs[self.fx_mode].set_focused(None)
self.knobs[self.fx_mode].fade_in = True
for b in self.fx_mode_buttons:
def set_fx_mode_by_name(self, side, mode):
self.knobs_display_side = side
self.knobs[side][self.fx_mode[side]].opacity = 0 #checke
self.fx_mode[side] = self.fx_mode_labels[side].index(mode)
self.knobs[side][self.fx_mode[side]].set_focused(None)
self.knobs[side][self.fx_mode[side]].fade_in = True
for b in self.fx_mode_buttons[side]:
b.focused = (b.name == mode)
def set_controller_fx_mode(self, side, mode):
i = self.fx_mode_labels[side].index(mode)
self.controller.set_fx_mode(side, i)
def show_athmos(self, show=True):
self.athmos.show_list = show
self.show_knobs = not show
self.beatplayer.show_selection = False
"""
if show == False:
self.set_selected_athmo()
"""
def show_beatplayer(self, show=True):
self.beatplayer.show_selection = show
self.show_knobs = not show
self.athmos.show_list = False
def set_athmo_index(self, index):
self.athmos.index = index
def set_beat_clip_index(self, index):
self.beatplayer.clip_selection.index = index
def set_beat_track_index(self, index):
self.beatplayer.track_selection.index = index
def set_selected_athmo(self, duration):
"""
name = self.athmos.get_name_by_index(self.athmos.index)
if len(name) > 20: name = name[0:22] + '...'
self.selected_athmo_srf = font_helvetica16.render(name, False, color_primary)
"""
self.selected_athmo_srf = self.athmos.selected_item_srf
self.athmos.current_duration = duration * 1000 if duration is not None else 0
self.athmos.time_started = pygame.time.get_ticks()
def set_athmo_filenames(self, filenames):
self.athmos.set_filenames(filenames)
def set_beat_track_names(self, names):
self.beatplayer.set_track_names(names)
def set_beat_clip_names(self, names):
self.beatplayer.set_clip_names(names)
def set_loop_input_mode(self, mode):
str_mode = 'SJ'
if mode == 0:
str_mode = 'S'
elif mode == 1:
str_mode = 'J'
self.loop_input_mode = font_helvetica16.render(str_mode, False, color_primary)
def update(self):
if self.running:
# fill the screen with a color to wipe away anything from last frame
@ -90,23 +217,40 @@ class GuiMain:
self.screen.blit(self.label_surface, (0,0))
self.label_surface = pygame.Surface((self.screenW, self.screenH), pygame.SRCALPHA)
self.knobs[self.fx_mode].display()
self.beatplayer.update()
self.athmos.update()
for button in self.fx_mode_buttons:
button.display()
self.knobs[self.knobs_display_side][self.fx_mode[self.knobs_display_side]].display()
for i in range(2):
for button in self.fx_mode_buttons[i]:
button.display()
self.mute_button.display()
for i in range(1,4):
pygame.draw.line(self.screen, color_primary_dark,
(self.fx_mode_buttons[i].radius_x*0.5 + 60, self.fx_mode_buttons[i].y),
(self.fx_mode_buttons[i].x - self.fx_mode_buttons[i].radius_x * 1.5,
self.fx_mode_buttons[i].y))
(self.fx_mode_buttons[0][i].radius_x*0.5 + 60, self.fx_mode_buttons[0][i].y),
(self.fx_mode_buttons[0][i].x - self.fx_mode_buttons[0][i].radius_x * 1.5,
self.fx_mode_buttons[0][i].y))
self.beat_button.display()
self.lloop_button.display()
self.rloop_button.display()
self.rec_button.display()
if self.selected_athmo_srf is not None:
self.screen.blit(self.selected_athmo_srf,
(self.screenW*3 / 18,
self.screenH - self.selected_athmo_srf.get_height()-10))
if pygame.time.get_ticks() - self.athmos.time_started >= self.athmos.current_duration:
self.selected_athmo_srf = None
if self.loop_input_mode is not None:
self.screen.blit(self.loop_input_mode,
((self.fx_mode_buttons[0][3].x+self.lloop_button.position[0])/2-self.loop_input_mode.get_width()/2,
(self.lloop_button.position[1]+self.rloop_button.position[1])/2-self.loop_input_mode.get_height()/2))
pygame.draw.polygon(self.screen, "white", [(0, self.screenH/2), (self.screenW*3 / 19, self.screenH), (0, self.screenH)])
# flip() the display to put your work on screen
pygame.display.flip()
@ -118,6 +262,36 @@ class GuiMain:
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
self.running = False
if event.key == pygame.K_RETURN:
if not self.beatplayer.show_selection:
self.show_beatplayer()
else:
self.show_beatplayer(False)
if event.key == pygame.K_INSERT:
if not self.athmos.show_list:
self.show_athmos()
else:
self.show_athmos(False)
if event.key == pygame.K_UP:
if self.athmos.show_list:
self.athmos.index -= 1
self.athmos.index %= self.athmos.get_count()
else:
self.beatplayer.clip_selection.index -= 1
self.beatplayer.clip_selection.index %= self.beatplayer.clip_selection.get_count()
if event.key == pygame.K_DOWN:
if self.athmos.show_list:
self.athmos.index += 1
self.athmos.index %= self.athmos.get_count()
else:
self.beatplayer.clip_selection.index += 1
self.beatplayer.clip_selection.index %= self.beatplayer.clip_selection.get_count()
if event.key == pygame.K_RIGHT:
self.beatplayer.track_selection.index += 1
self.beatplayer.track_selection.index %= self.beatplayer.track_selection.get_count()
if event.key == pygame.K_LEFT:
self.beatplayer.track_selection.index -= 1
self.beatplayer.track_selection.index %= self.beatplayer.track_selection.get_count()
elif event.type == pygame.QUIT:
self.running = False
elif event.type == pygame.MOUSEBUTTONDOWN: