123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682 |
- import utils as u
- import pygame
-
- def draw_menu1(o):
- bpm_inc = 4
- x_size = o.width / 4
- y_size = o.height / 4
- og_x = 0
- o_x = og_x
- o_y = o.height
- text_padding = 6
- _id = 0
- while _id < 16:
-
- o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.blue)
-
- if _id == 0:
- o.center_block("Main", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 1:
- o.center_block("Note", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 2:
- o.center_block("Patt", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 3:
- o.center_block("Song", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 4:
- o.center_block("File", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 5:
- o.center_block("Util", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- # if _id == 6:
- # o.center_block("Bank-", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- # if _id == 7:
- # o.center_block("Bank+", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 8:
- o.center_block("Vol-", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 9:
- o.center_block("Vol+", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- #if _id == 11:
- #o.center_block("", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 12:
- o.center_block("Play", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 13:
- o.center_block("Stop", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 10:
- o.center_block("BPM-", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 11:
- o.center_block("BPM+", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
-
-
- o_x = o_x + x_size
- _id += 1
- if _id % 4 == 0:
- o_y -= y_size
- o_x = og_x
-
-
- def draw_menu2_sample(o):
- bpm_inc = 4
- x_size = o.width / 4
- y_size = o.height / 4
- og_x = 0
- o_x = og_x
- o_y = o.height
- text_padding = 6
- _id = 0
- while _id < 16:
-
- o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.dark_grey)
-
-
- if _id == 0:
- o.center_block("Copy", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 1:
- o.center_block("Paste", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 2:
- o.center_block("Del", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 3:
- o.center_block("Load", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
-
- if _id == 8:
- o.center_block("Vol-", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 9:
- o.center_block("Vol+", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 6:
- o.center_block("Bank-", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 7:
- o.center_block("Bank+", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 10:
- o.center_block("Pitch-", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 11:
- o.center_block("Pitch+", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
-
-
-
- if _id == 12:
- if o.odub == True:
- o.center_block("Odub", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.pink)
- else:
- o.center_block("Odub", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 13:
- o.center_block("Undo", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
-
- if _id == 14:
- if o.erase == True:
- o.center_block("Erase", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.pink)
- else:
- o.center_block("Erase", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
-
- if _id == 15:
- if o.mute == True:
- o.center_block("Mute", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.pink)
- else:
- o.center_block("Mute", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
-
- o_x = o_x + x_size
- _id += 1
- if _id % 4 == 0:
- o_y -= y_size
- o_x = og_x
-
- def draw_menu2_pattern(o):
- bpm_inc = 4
- x_size = o.width / 4
- y_size = o.height / 4
- og_x = 0
- o_x = og_x
- o_y = o.height
- text_padding = 6
- _id = 0
- while _id < 16:
-
- o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.dark_grey)
-
- if _id == 0:
- o.center_block("Copy", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 1:
- o.center_block("Paste", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 2:
- o.center_block("Clear", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 6:
- o.center_block("Bank -", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 7:
- o.center_block("Bank +", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
-
- o_x = o_x + x_size
- _id += 1
- if _id % 4 == 0:
- o_y -= y_size
- o_x = og_x
-
- def draw_menu2_note(o):
- bpm_inc = 4
- x_size = o.width / 4
- y_size = o.height / 4
- og_x = 0
- o_x = og_x
- o_y = o.height
- text_padding = 6
- _id = 0
- while _id < 16:
-
- o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.dark_grey)
-
- if _id == 8:
- o.center_block("Vol -", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- elif _id == 9:
- o.center_block("Vol +", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- elif _id == 12:
- if o.patternFollow:
- o.center_block("Follow", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.pink)
- else:
- o.center_block("Follow", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
-
-
- o_x = o_x + x_size
- _id += 1
- if _id % 4 == 0:
- o_y -= y_size
- o_x = og_x
-
- def draw_menu2_song(o):
- bpm_inc = 4
- x_size = o.width / 4
- y_size = o.height / 4
- og_x = 0
- o_x = og_x
- o_y = o.height
- text_padding = 6
- _id = 0
- while _id < 16:
-
- o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.dark_grey)
-
- if _id == 6:
- o.center_block("Bank -", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 7:
- o.center_block("Bank +", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
-
- o_x = o_x + x_size
- _id += 1
- if _id % 4 == 0:
- o_y -= y_size
- o_x = og_x
-
- def draw_menu_saveas(o):
- bpm_inc = 4
- x_size = o.width / 2
- y_size = o.height / 4
- og_x = 0
- o_x = og_x
- o_y = o.height
- text_padding = 6
- _id = 0
- while _id < 8:
-
- o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.dark_grey)
-
- if _id == 6:
- o.center_block("Select Folder", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
- if _id == 7:
- o.center_block("New Folder", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
-
-
- o_x = o_x + x_size
- _id += 1
- if _id % 2 == 0:
- o_y -= y_size
- o_x = og_x
-
-
- def menu1_actions(self, o):
- if o.keyState[8] == 4 or o.keyState[8] == 3:
- print('reset repeat from menu')
- o.button_repeater(1,[])
-
- if o.keyState[9] == 4 or o.keyState[9] == 3:
- print('reset repeat from menu')
- o.button_repeater(1,[])
-
- if o.keyState[16] == 2:
- #print('key 8 ', o.keyState[8])
- #o.button_repeater(0, [8,9,14,15])
-
- if o.keyState[0] == 1:
- self.FSM.ToTransition('toMain')
- elif o.keyState[1] == 1:
- self.FSM.ToTransition('toEditSoundSequence')
- elif o.keyState[2] == 1:
- self.FSM.ToTransition('toSelectPattern')
- elif o.keyState[3] == 1:
- self.FSM.ToTransition('toEditSong')
- elif o.keyState[4] == 1:
- self.FSM.ToTransition('toFile')
- elif o.keyState[5] == 1:
- self.FSM.ToTransition('toUtil')
- if o.keyState[12] == 1:
- o.start_playback()
- u.play_seq(o, [o.curPattern, 0])
- if o.keyState[13] == 1:
- o.stop_playback()
-
- if o.keyState[8] == 2:
- if (o.repeater_states[8] != None and ((pygame.time.get_ticks() - o.repeater_states[8]) > 500)):
- if o.volume > 0:
- o.volume -= 1
- u.text_center(o, "Master Volume", str(o.volume))
- o.update_display(0)
- o.repeater_states[8] = pygame.time.get_ticks()
-
- if o.keyState[8] == 1:
- o.repeater_states[8] = pygame.time.get_ticks()
- if o.volume > 0:
- o.volume -= 1
- u.text_center(o, "Master Volume", str(o.volume))
- o.update_display(0)
-
- if o.keyState[9] == 2:
- if (o.repeater_states[9] != None and ((pygame.time.get_ticks() - o.repeater_states[9]) > 500)):
- if o.volume < 16:
- o.volume += 1
- u.text_center(o, "Master Volume", str(o.volume))
- o.update_display(0)
- o.repeater_states[9] = pygame.time.get_ticks()
-
- if o.keyState[9] == 1:
- o.repeater_states[9] = pygame.time.get_ticks()
- if o.volume < 16:
- o.volume += 1
- u.text_center(o, "Master Volume", str(o.volume))
- o.update_display(0)
- if o.keyState[11] == 1:
- #o.save_song()
-
- pass
-
- if o.keyState[10] == 2:
- if (o.repeater_states[10] != None and ((pygame.time.get_ticks() - o.repeater_states[10]) > 500)):
- if o.bpm > 60:
- o.bpm = o.bpm - o.bpm_inc
- o.update_bpm()
- u.text_center(o, "Master BPM", str(o.bpm))
- o.update_display(0)
- o.repeater_states[10] = pygame.time.get_ticks()
-
- if o.keyState[10] == 1:
- o.repeater_states[10] = pygame.time.get_ticks()
- if o.bpm > 60:
- o.bpm = o.bpm - o.bpm_inc
- o.update_bpm()
- u.text_center(o, "Master BPM", str(o.bpm))
- o.update_display(0)
-
- if o.keyState[11] == 2:
- if (o.repeater_states[11] != None and ((pygame.time.get_ticks() - o.repeater_states[11]) > 500)):
- if o.bpm < 240:
- o.bpm = o.bpm + o.bpm_inc
- o.update_bpm()
- u.text_center(o, "Master BPM", str(o.bpm))
- o.update_display(0)
- o.repeater_states[11] = pygame.time.get_ticks()
-
- if o.keyState[11] == 1:
- o.repeater_states[11] = pygame.time.get_ticks()
- if o.bpm < 240:
- o.bpm = o.bpm + o.bpm_inc
- o.update_bpm()
- u.text_center(o, "Master BPM", str(o.bpm))
- o.update_display(0)
-
-
- def menu2_actions_sample(self, o):
- if o.keyState[6] == 4 or o.keyState[6] == 3:
- print('reset repeat from menu')
- o.button_repeater(1,[])
-
- if o.keyState[7] == 4 or o.keyState[7] == 3:
- print('reset repeat from menu')
- o.button_repeater(1,[])
-
- if o.keyState[8] == 4 or o.keyState[8] == 3:
- print('reset repeat from menu')
- o.button_repeater(1,[])
-
- if o.keyState[9] == 4 or o.keyState[9] == 3:
- print('reset repeat from menu')
- o.button_repeater(1,[])
-
- if o.keyState[10] == 4 or o.keyState[10] == 3:
- print('reset repeat from menu')
- o.button_repeater(1,[])
-
- if o.keyState[11] == 4 or o.keyState[11] == 3:
- print('reset repeat from menu')
- o.button_repeater(1,[])
-
- if o.keyState[17] == 2:
- if o.keyState[0] == 1:
- if o.soundSlots[o.eSound].volume > 0:
- print('copy')
- o.soundClipboard = [o.soundSlots[o.eSound].file, o.soundSlots[o.eSound].volume, o.soundSlots[o.eSound].pitch]
- print(o.soundClipboard)
-
- if o.keyState[1] == 1:
- if o.soundClipboard != []:
- print('pasting ', o.soundClipboard)
- o.soundSlots[o.eSound].file = o.soundClipboard[0]
- o.soundSlots[o.eSound].volume = o.soundClipboard[1]
- o.soundSlots[o.eSound].pitch = o.soundClipboard[2]
- o.soundSlots[o.eSound].create_sound()
- o.soundSlots[o.eSound].set_pitch()
-
- if o.keyState[2] == 1:
- print('delete sound ', o.eSound)
- o.soundSlots[o.eSound].file = None
- o.soundSlots[o.eSound].volume = 16
- o.soundSlots[o.eSound].pitch = 0
- if o.keyState[3] == 1:
- print('load')
- o.FSM.FSM.ToTransition("toLoadSound")
-
- if o.keyState[8] == 2:
- if (o.repeater_states[8] != None and ((pygame.time.get_ticks() - o.repeater_states[8]) > 500)):
- if o.soundSlots[o.eSound].volume > 0:
- o.soundSlots[o.eSound].volume -= 1
- u.text_center(o, "Sample Volume", str(o.soundSlots[o.eSound].volume))
- o.update_display(0)
- o.repeater_states[8] = pygame.time.get_ticks()
-
- if o.keyState[8] == 1:
- if o.soundSlots[o.eSound].volume > 0:
- o.soundSlots[o.eSound].volume -= 1
- u.text_center(o, "Sample Volume", str(o.soundSlots[o.eSound].volume))
- o.update_display(0)
- o.repeater_states[8] = pygame.time.get_ticks()
-
- if o.keyState[9] == 2:
- if (o.repeater_states[9] != None and ((pygame.time.get_ticks() - o.repeater_states[9]) > 500)):
- if o.soundSlots[o.eSound].volume < 16:
- o.soundSlots[o.eSound].volume += 1
- u.text_center(o, "Sample Volume", str(o.soundSlots[o.eSound].volume))
- o.update_display(0)
- o.repeater_states[9] = pygame.time.get_ticks()
-
- if o.keyState[9] == 1:
- if o.soundSlots[o.eSound].volume < 16:
- o.soundSlots[o.eSound].volume += 1
- u.text_center(o, "Sample Volume", str(o.soundSlots[o.eSound].volume))
- o.update_display(0)
- o.repeater_states[9] = pygame.time.get_ticks()
-
- if o.keyState[6] == 2:
- if (o.repeater_states[6] != None and ((pygame.time.get_ticks() - o.repeater_states[6]) > 500)):
- if o.note_bank > 0:
- o.note_bank -= 1
- u.text_center(o, "Sound Bank", str(o.note_bank))
- o.update_display(0)
- o.repeater_states[6] = pygame.time.get_ticks()
-
- if o.keyState[6] == 1:
- if o.note_bank > 0:
- o.note_bank -= 1
- u.text_center(o, "Sound Bank", str(o.note_bank))
- o.repeater_states[6] = pygame.time.get_ticks()
- o.update_display(0)
-
- if o.keyState[7] == 2:
- if (o.repeater_states[7] != None and ((pygame.time.get_ticks() - o.repeater_states[7]) > 500)):
- if o.note_bank < 3:
- o.note_bank += 1
- u.text_center(o, "Sound Bank", str(o.note_bank))
- o.update_display(0)
- o.repeater_states[7] = pygame.time.get_ticks()
-
- if o.keyState[7] == 1:
- if o.note_bank < 3:
- o.note_bank += 1
- u.text_center(o, "Sound Bank", str(o.note_bank))
- o.repeater_states[7] = pygame.time.get_ticks()
- o.update_display(0)
-
- if o.keyState[10] == 2:
- if (o.repeater_states[10] != None and ((pygame.time.get_ticks() - o.repeater_states[10]) > 500)):
- if o.soundSlots[o.eSound].pitch > -10:
- o.soundSlots[o.eSound].pitch -= 1
- u.text_center(o, "Sample Pitch", str(o.soundSlots[o.eSound].pitch))
- o.soundSlots[o.eSound].set_pitch()
- o.update_display(0)
- o.repeater_states[10] = pygame.time.get_ticks()
-
-
- if o.keyState[10] == 1:
- if o.soundSlots[o.eSound].pitch > -10:
- o.soundSlots[o.eSound].pitch -= 1
- u.text_center(o, "Sample Pitch", str(o.soundSlots[o.eSound].pitch))
- o.soundSlots[o.eSound].set_pitch()
- o.repeater_states[10] = pygame.time.get_ticks()
- o.update_display(0)
-
- if o.keyState[11] == 2:
- if (o.repeater_states[11] != None and ((pygame.time.get_ticks() - o.repeater_states[11]) > 500)):
- if o.soundSlots[o.eSound].pitch < 10:
- o.soundSlots[o.eSound].pitch += 1
- u.text_center(o, "Sample Pitch", str(o.soundSlots[o.eSound].pitch))
- o.soundSlots[o.eSound].set_pitch()
- o.update_display(0)
- o.repeater_states[11] = pygame.time.get_ticks()
-
-
- if o.keyState[11] == 1:
- if o.soundSlots[o.eSound].pitch < 10:
- o.soundSlots[o.eSound].pitch += 1
- u.text_center(o, "Sample Pitch", str(o.soundSlots[o.eSound].pitch))
- o.soundSlots[o.eSound].set_pitch()
- o.repeater_states[11] = pygame.time.get_ticks()
- o.update_display(0)
-
- if o.keyState[12] == 1:
- o.odub = not o.odub
- o.undo_buf = []
- print('odub now is ', o.odub)
- draw_menu2_sample(o)
- o.update_display(0)
-
- if o.keyState[13] == 1:
- print('undo something')
- for i in o.undo_buf:
- o.soundSlots[i[0]].notes[i[1]][i[2]][0] = 0
- o.soundSlots[i[0]].notes[i[1]][i[2]][1] = 0
- o.undo_buf = []
-
- if o.keyState[14] == 1:
- o.erase = not o.erase
- o.erase_buf = []
- print('erase now is ', o.erase)
- if o.erase:
- o.mute = False
- o.mute_buf = []
- draw_menu2_sample(o)
- o.update_display(0)
-
- if o.keyState[15] == 1:
- o.mute = not o.mute
- o.mute_buf = []
- print('mute now is ', o.mute)
- if o.mute:
- o.erase = False
- o.erase_buf = []
- draw_menu2_sample(o)
- o.update_display(0)
-
- def menu2_actions_pattern(self, o):
- if o.keyState[17] == 2:
- if o.keyState[0] == 1:
- print('copy')
- o.patternClipboard = []
- for s in o.soundSlots:
- notes = []
- for i in s.notes[o.ePattern]:
- notes.append([i[0], i[1]])
- o.patternClipboard.append(notes)
- print('adding to clip ', notes)
-
- elif o.keyState[1] == 1:
- print('paste')
- if o.patternClipboard != []:
- p = 0
- for s in o.soundSlots:
- n = 0
- for i in s.notes[o.ePattern]:
- i[0] = o.patternClipboard[p][n][0]
- i[1] = o.patternClipboard[p][n][1]
- n += 1
- print('added ', o.patternClipboard[p])
- p += 1
- else:
- print('nothing to paste')
-
- elif o.keyState[2] == 1:
- print('clear')
- print(o.soundSlots[o.eSound].notes[o.ePattern])
- for s in o.soundSlots:
- for i in s.notes[o.ePattern]:
- i[0] = 0
- i[1] = 0
-
- elif o.keyState[6] == 1:
- if o.pat_bank > 0:
- o.pat_bank -= 1
- u.text_center(o, "Pattern Bank", str(o.pat_bank))
- o.update_display(0)
-
- elif o.keyState[7] == 1:
- if o.pat_bank < 3:
- o.pat_bank += 1
- u.text_center(o, "Pattern Bank", str(o.pat_bank))
- o.update_display(0)
-
- def menu2_actions_song(self, o):
- if o.keyState[17] == 2:
-
- if o.keyState[6] == 1:
- if o.pat_bank > 0:
- o.pat_bank -= 1
- u.text_center(o, "Pattern Bank", str(o.pat_bank))
- o.update_display(0)
- elif o.keyState[7] == 1:
- if o.pat_bank < 3:
- o.pat_bank += 1
- u.text_center(o, "Pattern Bank", str(o.pat_bank))
- o.update_display(0)
-
-
-
-
- def menu2_actions_note(self, o):
- if o.keyState[8] == 4 or o.keyState[8] == 3:
- print('reset repeat from menu')
- o.button_repeater(1,[])
-
- if o.keyState[9] == 4 or o.keyState[9] == 3:
- print('reset repeat from menu')
- o.button_repeater(1,[])
-
- if o.keyState[17] == 2:
-
-
- if o.keyState[8] == 2:
- if (o.repeater_states[8] != None and ((pygame.time.get_ticks() - o.repeater_states[8]) > 500)):
- if o.note_vol > 0:
- o.note_vol -= 1
- u.text_center(o, "Note Volume", str(o.note_vol))
- o.update_display(0)
- o.repeater_states[8] = pygame.time.get_ticks()
-
- if o.keyState[8] == 1:
- if o.note_vol > 0:
- o.note_vol -= 1
- u.text_center(o, "Note Volume", str(o.note_vol))
- o.repeater_states[8] = pygame.time.get_ticks()
- o.update_display(0)
-
- if o.keyState[9] == 2:
- if (o.repeater_states[9] != None and ((pygame.time.get_ticks() - o.repeater_states[9]) > 500)):
- if o.note_vol < 16:
- o.note_vol += 1
- u.text_center(o, "Note Volume", str(o.note_vol))
- o.update_display(0)
- o.repeater_states[9] = pygame.time.get_ticks()
-
- if o.keyState[9] == 1:
- if o.note_vol < 16:
- o.note_vol += 1
- u.text_center(o, "Note Volume", str(o.note_vol))
- o.repeater_states[9] = pygame.time.get_ticks()
- o.update_display(0)
-
- if o.keyState[12] == 1:
- if o.patternFollow:
- o.patternFollow = False
- else:
- o.patternFollow = True
-
- print('pattern follow is ', o.patternFollow)
- draw_menu2_note(o)
- o.update_display(0)
-
-
- def menu2_actions_saveas(self, o):
- if o.keyState[17] == 2:
- if o.keyState[12] == 1:
- print('select folder')
- self.FSM.ToTransition('toSelectFolder')
- elif o.keyState[14] == 1:
- print('new folder')
- #o.song_dir
- #os.mkdir(path)
- self.FSM.ToTransition('toNewDir')
-
-
- def util_command(self, o, command):
- if command == "Clock":
- self.FSM.ToTransition('toClock')
- elif command == "Balls":
- self.FSM.ToTransition('toBall')
- elif command == "Defender":
- self.FSM.ToTransition('toDefender')
- elif command == "Calculator":
- self.FSM.ToTransition('toCalculator')
-
- elif command == "Exit":
- self.FSM.ToTransition('toExit')
- elif command == "Theme":
- self.FSM.ToTransition('toSelTheme')
- elif command == "Reboot":
- self.FSM.ToTransition('toReboot')
- elif command == "Update":
- self.FSM.ToTransition('toUpdate')
- #os.system("sudo reboot")
- elif command == "Shutdown":
- self.FSM.ToTransition('toShutdown')
- elif command == "Ping":
- self.FSM.ToTransition('toPing')
- elif command == "Wifi":
- self.FSM.ToTransition('toWifi')
- elif command == "About":
- self.FSM.ToTransition('toAbout')
-
- def file_command(self, o, command):
- if command == "Save":
- if o.sconf['title'] != "blank":
- o.save_song()
- else:
- print('cant save over blank')
-
- elif command == "Open":
- self.FSM.ToTransition('toOpenSong')
- elif command == "Save As":
- self.FSM.ToTransition('toEnterText')
- elif command == "New":
- #self.FSM.ToTransition('toEnterText')
- #o.title = '_blank'
- o.mconf['default_song'] = '_blank'
- o.load_song()
|