adjusted item_selection and created a module 'beatplayer'
This commit is contained in:
38
main.py
38
main.py
@ -6,6 +6,7 @@ from .lozenge_button import LozengeButton
|
||||
from .binary_button import BinaryButton
|
||||
from .circle_button import *
|
||||
from .athmos import Athmos
|
||||
from .beatplayer import BeatPlayer
|
||||
|
||||
class GuiMain:
|
||||
|
||||
@ -70,9 +71,11 @@ class GuiMain:
|
||||
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
|
||||
self.set_athmo_filenames([
|
||||
fnames = [
|
||||
"01_7Qp3xL8gK2tA5mR9eZ1vC4bN6sH0jF",
|
||||
"02_yP5cT8kL3wR0vX6mN9bQ2fZ4hJ7dS1",
|
||||
"03_3aB7eF2gH9jK5lM1nP6qR0sT8uV4B7eF2gH9jK5lM1nP6qR0sT8uV4wX",
|
||||
@ -85,8 +88,11 @@ class GuiMain:
|
||||
"10_6jL1fH7gK9wL0q3xZ4rE5pQ8oR3iK2",
|
||||
"11_0jF7Qp3xL8gK2tA5mR9eZ1vC4bN6sH",
|
||||
"12_4hJ7dS1yP5cT8kL3wR0vX6mN9bQ2fZ",
|
||||
"13_9jK5lM1nP6qR0sT8uV4wX3aB7eF2gH",
|
||||
])
|
||||
"13_9jK5lM1nP6qR0sT8uV4wX3aB7eF2gH"
|
||||
]
|
||||
self.beatplayer.set_clip_names(fnames)
|
||||
self.beatplayer.set_track_names(fnames)
|
||||
self.set_athmo_filenames(fnames)
|
||||
self.selected_athmo_srf = None
|
||||
|
||||
self.clock = pygame.time.Clock()
|
||||
@ -109,9 +115,15 @@ class GuiMain:
|
||||
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
|
||||
|
||||
@ -138,6 +150,7 @@ class GuiMain:
|
||||
self.screen.blit(self.label_surface, (0,0))
|
||||
self.label_surface = pygame.Surface((self.screenW, self.screenH), pygame.SRCALPHA)
|
||||
|
||||
self.beatplayer.update()
|
||||
self.athmos.update()
|
||||
|
||||
self.knobs[self.fx_mode].display()
|
||||
@ -178,6 +191,11 @@ 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()
|
||||
@ -187,10 +205,24 @@ class GuiMain:
|
||||
if self.athmos.show_list:
|
||||
self.athmos.index -= 1
|
||||
self.athmos.index %= self.athmos.get_count()
|
||||
elif self.beatplayer.show_selection:
|
||||
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()
|
||||
elif self.beatplayer.show_selection:
|
||||
self.beatplayer.clip_selection.index += 1
|
||||
self.beatplayer.clip_selection.index %= self.beatplayer.clip_selection.get_count()
|
||||
if event.key == pygame.K_RIGHT:
|
||||
if self.beatplayer.show_selection:
|
||||
self.beatplayer.track_selection.index += 1
|
||||
self.beatplayer.track_selection.index %= self.beatplayer.track_selection.get_count()
|
||||
if event.key == pygame.K_LEFT:
|
||||
if self.beatplayer.show_selection:
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user