added a knobs instance for every fx_mode

This commit is contained in:
SallarShayegan
2025-02-28 14:04:53 +01:00
parent 3eae3a7cf6
commit b960bcbd7f
2 changed files with 21 additions and 13 deletions

View File

@ -2,10 +2,11 @@ import pygame
from colors import *
from fonts import *
from knob import *
import random
class Knobs:
def __init__(self, gui, values):
def __init__(self, gui):
self.gui = gui
@ -20,7 +21,9 @@ class Knobs:
'Gain'
]
self.values = values
self.values = []
for i in range(len(knob_names)):
self.values.append(random.random())
# Create and position the knobs
self.knobs_radius = self.gui.screenW / 25
@ -31,7 +34,7 @@ class Knobs:
y = knobs_y
self.knobs = []
for i in range(8):
self.knobs.append(Knob(self, knob_names[i], self.knobs_radius, (x, y), values[i]))
self.knobs.append(Knob(self, knob_names[i], self.knobs_radius, (x, y), self.values[i]))
y += self.knobs_radius + knobs_spacing
if i == 3 or i == 6:
x += self.knobs_radius + knobs_spacing
@ -39,7 +42,7 @@ class Knobs:
def display_label(self, knob):
label_fx_name = font_helvetica.render(knob.name, False, color_primary_light)
label_fx_value = font_helvetica.render('[ ' + str(knob.value*100) + '% ]',
label_fx_value = font_helvetica.render('[ ' + str(int(round(knob.value * 100, 0))) + '% ]',
False, color_primary_light)
label_x = self.gui.screenW - label_fx_name.get_width() - 20