|
@@ -1,5 +1,6 @@
|
1
|
1
|
import utils as u
|
2
|
2
|
import pygame
|
|
3
|
+from itertools import cycle
|
3
|
4
|
|
4
|
5
|
def draw_menu1(o):
|
5
|
6
|
bpm_inc = 4
|
|
@@ -63,9 +64,7 @@ def draw_menu2_sample(o):
|
63
|
64
|
text_padding = 6
|
64
|
65
|
_id = 0
|
65
|
66
|
while _id < 16:
|
66
|
|
-
|
67
|
67
|
o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.dark_grey)
|
68
|
|
-
|
69
|
68
|
|
70
|
69
|
if _id == 0:
|
71
|
70
|
o.center_block("Copy", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
|
|
@@ -75,6 +74,12 @@ def draw_menu2_sample(o):
|
75
|
74
|
o.center_block("Del", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
|
76
|
75
|
if _id == 3:
|
77
|
76
|
o.center_block("Load", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
|
|
77
|
+
|
|
78
|
+ if _id == 4:
|
|
79
|
+ if o.prev == True:
|
|
80
|
+ o.center_block("Prev", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.pink)
|
|
81
|
+ else:
|
|
82
|
+ o.center_block("Prev", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
|
78
|
83
|
|
79
|
84
|
if _id == 8:
|
80
|
85
|
o.center_block("Vol-", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
|
|
@@ -141,6 +146,17 @@ def draw_menu2_pattern(o):
|
141
|
146
|
if _id == 7:
|
142
|
147
|
o.center_block("Bank +", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
|
143
|
148
|
|
|
149
|
+ if _id == 12:
|
|
150
|
+ if o.pat_odub:
|
|
151
|
+ o.center_block("Odub", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.pink)
|
|
152
|
+ else:
|
|
153
|
+ o.center_block("Odub", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
|
|
154
|
+ if _id == 13:
|
|
155
|
+ if o.pat_perf:
|
|
156
|
+ o.center_block("Perf", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.pink)
|
|
157
|
+ else:
|
|
158
|
+ o.center_block("Perf", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
|
|
159
|
+
|
144
|
160
|
o_x = o_x + x_size
|
145
|
161
|
_id += 1
|
146
|
162
|
if _id % 4 == 0:
|
|
@@ -229,11 +245,11 @@ def draw_menu_saveas(o):
|
229
|
245
|
|
230
|
246
|
def menu1_actions(self, o):
|
231
|
247
|
if o.keyState[8] == 4 or o.keyState[8] == 3:
|
232
|
|
- print('reset repeat from menu')
|
|
248
|
+ #print('reset repeat from menu')
|
233
|
249
|
o.button_repeater(1,[])
|
234
|
250
|
|
235
|
251
|
if o.keyState[9] == 4 or o.keyState[9] == 3:
|
236
|
|
- print('reset repeat from menu')
|
|
252
|
+ #print('reset repeat from menu')
|
237
|
253
|
o.button_repeater(1,[])
|
238
|
254
|
|
239
|
255
|
if o.keyState[16] == 2:
|
|
@@ -329,39 +345,39 @@ def menu1_actions(self, o):
|
329
|
345
|
|
330
|
346
|
def menu2_actions_sample(self, o):
|
331
|
347
|
if o.keyState[6] == 4 or o.keyState[6] == 3:
|
332
|
|
- print('reset repeat from menu')
|
|
348
|
+ #print('reset repeat from menu')
|
333
|
349
|
o.button_repeater(1,[])
|
334
|
350
|
|
335
|
351
|
if o.keyState[7] == 4 or o.keyState[7] == 3:
|
336
|
|
- print('reset repeat from menu')
|
|
352
|
+ #print('reset repeat from menu')
|
337
|
353
|
o.button_repeater(1,[])
|
338
|
354
|
|
339
|
355
|
if o.keyState[8] == 4 or o.keyState[8] == 3:
|
340
|
|
- print('reset repeat from menu')
|
|
356
|
+ #print('reset repeat from menu')
|
341
|
357
|
o.button_repeater(1,[])
|
342
|
358
|
|
343
|
359
|
if o.keyState[9] == 4 or o.keyState[9] == 3:
|
344
|
|
- print('reset repeat from menu')
|
|
360
|
+ #print('reset repeat from menu')
|
345
|
361
|
o.button_repeater(1,[])
|
346
|
362
|
|
347
|
363
|
if o.keyState[10] == 4 or o.keyState[10] == 3:
|
348
|
|
- print('reset repeat from menu')
|
|
364
|
+ #print('reset repeat from menu')
|
349
|
365
|
o.button_repeater(1,[])
|
350
|
366
|
|
351
|
367
|
if o.keyState[11] == 4 or o.keyState[11] == 3:
|
352
|
|
- print('reset repeat from menu')
|
|
368
|
+ #print('reset repeat from menu')
|
353
|
369
|
o.button_repeater(1,[])
|
354
|
370
|
|
355
|
371
|
if o.keyState[17] == 2:
|
356
|
372
|
if o.keyState[0] == 1:
|
357
|
373
|
if o.soundSlots[o.eSound].volume > 0:
|
358
|
|
- print('copy')
|
|
374
|
+ #print('copy')
|
359
|
375
|
o.soundClipboard = [o.soundSlots[o.eSound].file, o.soundSlots[o.eSound].volume, o.soundSlots[o.eSound].pitch]
|
360
|
|
- print(o.soundClipboard)
|
|
376
|
+ #print(o.soundClipboard)
|
361
|
377
|
|
362
|
378
|
if o.keyState[1] == 1:
|
363
|
379
|
if o.soundClipboard != []:
|
364
|
|
- print('pasting ', o.soundClipboard)
|
|
380
|
+ #print('pasting ', o.soundClipboard)
|
365
|
381
|
o.soundSlots[o.eSound].file = o.soundClipboard[0]
|
366
|
382
|
o.soundSlots[o.eSound].volume = o.soundClipboard[1]
|
367
|
383
|
o.soundSlots[o.eSound].pitch = o.soundClipboard[2]
|
|
@@ -369,14 +385,20 @@ def menu2_actions_sample(self, o):
|
369
|
385
|
o.soundSlots[o.eSound].set_pitch()
|
370
|
386
|
|
371
|
387
|
if o.keyState[2] == 1:
|
372
|
|
- print('delete sound ', o.eSound)
|
|
388
|
+ #print('delete sound ', o.eSound)
|
373
|
389
|
o.soundSlots[o.eSound].file = None
|
374
|
390
|
o.soundSlots[o.eSound].volume = 16
|
375
|
391
|
o.soundSlots[o.eSound].pitch = 0
|
376
|
392
|
if o.keyState[3] == 1:
|
377
|
|
- print('load')
|
|
393
|
+ #print('load')
|
378
|
394
|
o.FSM.FSM.ToTransition("toLoadSound")
|
379
|
395
|
|
|
396
|
+
|
|
397
|
+ if o.keyState[4] == 1:
|
|
398
|
+ o.prev = not o.prev
|
|
399
|
+ draw_menu2_sample(o)
|
|
400
|
+ o.update_display(0)
|
|
401
|
+
|
380
|
402
|
if o.keyState[8] == 2:
|
381
|
403
|
if (o.repeater_states[8] != None and ((pygame.time.get_ticks() - o.repeater_states[8]) > 500)):
|
382
|
404
|
if o.soundSlots[o.eSound].volume > 0:
|
|
@@ -476,12 +498,12 @@ def menu2_actions_sample(self, o):
|
476
|
498
|
if o.keyState[12] == 1:
|
477
|
499
|
o.odub = not o.odub
|
478
|
500
|
o.undo_buf = []
|
479
|
|
- print('odub now is ', o.odub)
|
|
501
|
+ #print('odub now is ', o.odub)
|
480
|
502
|
draw_menu2_sample(o)
|
481
|
503
|
o.update_display(0)
|
482
|
504
|
|
483
|
505
|
if o.keyState[13] == 1:
|
484
|
|
- print('undo something')
|
|
506
|
+ #print('undo something')
|
485
|
507
|
for i in o.undo_buf:
|
486
|
508
|
o.soundSlots[i[0]].notes[i[1]][i[2]][0] = 0
|
487
|
509
|
o.soundSlots[i[0]].notes[i[1]][i[2]][1] = 0
|
|
@@ -490,7 +512,7 @@ def menu2_actions_sample(self, o):
|
490
|
512
|
if o.keyState[14] == 1:
|
491
|
513
|
o.erase = not o.erase
|
492
|
514
|
o.erase_buf = []
|
493
|
|
- print('erase now is ', o.erase)
|
|
515
|
+ #print('erase now is ', o.erase)
|
494
|
516
|
if o.erase:
|
495
|
517
|
o.mute = False
|
496
|
518
|
o.mute_buf = []
|
|
@@ -500,7 +522,7 @@ def menu2_actions_sample(self, o):
|
500
|
522
|
if o.keyState[15] == 1:
|
501
|
523
|
o.mute = not o.mute
|
502
|
524
|
o.mute_buf = []
|
503
|
|
- print('mute now is ', o.mute)
|
|
525
|
+ #print('mute now is ', o.mute)
|
504
|
526
|
if o.mute:
|
505
|
527
|
o.erase = False
|
506
|
528
|
o.erase_buf = []
|
|
@@ -554,6 +576,42 @@ def menu2_actions_pattern(self, o):
|
554
|
576
|
u.text_center(o, "Pattern Bank", str(o.pat_bank))
|
555
|
577
|
o.update_display(0)
|
556
|
578
|
|
|
579
|
+#--------------------------------------------
|
|
580
|
+ elif o.keyState[12] == 1:
|
|
581
|
+ o.pat_odub = not o.pat_odub
|
|
582
|
+ if o.pat_odub:
|
|
583
|
+ if o.playing:
|
|
584
|
+ o.stop_playback()
|
|
585
|
+ o.song_in = [o.curPattern]
|
|
586
|
+ if o.pat_perf:
|
|
587
|
+ pass
|
|
588
|
+ else:
|
|
589
|
+ o.pat_perf = True
|
|
590
|
+ else:
|
|
591
|
+ o.pat_perf = False
|
|
592
|
+ o.song = o.song_in
|
|
593
|
+ o.pat_buf = o.song_in
|
|
594
|
+ o.song_in = []
|
|
595
|
+ o.songCycle = cycle(o.song)
|
|
596
|
+ o.songStart = o.song[0]
|
|
597
|
+
|
|
598
|
+ draw_menu2_pattern(o)
|
|
599
|
+ o.update_display(0)
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+ elif o.keyState[13] == 1:
|
|
603
|
+ o.pat_perf = not o.pat_perf
|
|
604
|
+ if o.pat_perf:
|
|
605
|
+ o.pat_buf = o.song
|
|
606
|
+ o.song = []
|
|
607
|
+ print('song is now ', o.song)
|
|
608
|
+ else:
|
|
609
|
+ o.song = o.pat_buf
|
|
610
|
+ print('song is now ', o.song)
|
|
611
|
+
|
|
612
|
+ draw_menu2_pattern(o)
|
|
613
|
+ o.update_display(0)
|
|
614
|
+
|
557
|
615
|
def menu2_actions_song(self, o):
|
558
|
616
|
if o.keyState[17] == 2:
|
559
|
617
|
|
|
@@ -573,11 +631,11 @@ def menu2_actions_song(self, o):
|
573
|
631
|
|
574
|
632
|
def menu2_actions_note(self, o):
|
575
|
633
|
if o.keyState[8] == 4 or o.keyState[8] == 3:
|
576
|
|
- print('reset repeat from menu')
|
|
634
|
+ #print('reset repeat from menu')
|
577
|
635
|
o.button_repeater(1,[])
|
578
|
636
|
|
579
|
637
|
if o.keyState[9] == 4 or o.keyState[9] == 3:
|
580
|
|
- print('reset repeat from menu')
|
|
638
|
+ #print('reset repeat from menu')
|
581
|
639
|
o.button_repeater(1,[])
|
582
|
640
|
|
583
|
641
|
if o.keyState[17] == 2:
|
|
@@ -619,7 +677,7 @@ def menu2_actions_note(self, o):
|
619
|
677
|
else:
|
620
|
678
|
o.patternFollow = True
|
621
|
679
|
|
622
|
|
- print('pattern follow is ', o.patternFollow)
|
|
680
|
+ #print('pattern follow is ', o.patternFollow)
|
623
|
681
|
draw_menu2_note(o)
|
624
|
682
|
o.update_display(0)
|
625
|
683
|
|
|
@@ -627,12 +685,10 @@ def menu2_actions_note(self, o):
|
627
|
685
|
def menu2_actions_saveas(self, o):
|
628
|
686
|
if o.keyState[17] == 2:
|
629
|
687
|
if o.keyState[12] == 1:
|
630
|
|
- print('select folder')
|
|
688
|
+ #print('select folder')
|
631
|
689
|
self.FSM.ToTransition('toSelectFolder')
|
632
|
690
|
elif o.keyState[14] == 1:
|
633
|
|
- print('new folder')
|
634
|
|
- #o.song_dir
|
635
|
|
- #os.mkdir(path)
|
|
691
|
+ #print('new folder')
|
636
|
692
|
self.FSM.ToTransition('toNewDir')
|
637
|
693
|
|
638
|
694
|
|
|
@@ -645,7 +701,6 @@ def util_command(self, o, command):
|
645
|
701
|
self.FSM.ToTransition('toDefender')
|
646
|
702
|
elif command == "Calculator":
|
647
|
703
|
self.FSM.ToTransition('toCalculator')
|
648
|
|
-
|
649
|
704
|
elif command == "Exit":
|
650
|
705
|
self.FSM.ToTransition('toExit')
|
651
|
706
|
elif command == "Theme":
|
|
@@ -654,7 +709,6 @@ def util_command(self, o, command):
|
654
|
709
|
self.FSM.ToTransition('toReboot')
|
655
|
710
|
elif command == "Update":
|
656
|
711
|
self.FSM.ToTransition('toUpdate')
|
657
|
|
- #os.system("sudo reboot")
|
658
|
712
|
elif command == "Shutdown":
|
659
|
713
|
self.FSM.ToTransition('toShutdown')
|
660
|
714
|
elif command == "Ping":
|
|
@@ -669,14 +723,15 @@ def file_command(self, o, command):
|
669
|
723
|
if o.sconf['title'] != "blank":
|
670
|
724
|
o.save_song()
|
671
|
725
|
else:
|
672
|
|
- print('cant save over blank')
|
|
726
|
+ pass
|
|
727
|
+ #print('cant save over blank')
|
673
|
728
|
|
674
|
729
|
elif command == "Open":
|
675
|
730
|
self.FSM.ToTransition('toOpenSong')
|
676
|
731
|
elif command == "Save As":
|
677
|
732
|
self.FSM.ToTransition('toEnterText')
|
678
|
733
|
elif command == "New":
|
679
|
|
- #self.FSM.ToTransition('toEnterText')
|
680
|
|
- #o.title = '_blank'
|
|
734
|
+ o.song_dir = o.base_song_dir
|
681
|
735
|
o.mconf['default_song'] = '_blank'
|
682
|
|
- o.load_song()
|
|
736
|
+ o.load_song()
|
|
737
|
+ self.FSM.ToTransition('toMain')
|