forked from SuperRiderTH/CAT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpolish_notes.py
More file actions
104 lines (80 loc) · 3.41 KB
/
polish_notes.py
File metadata and controls
104 lines (80 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
from reaper_python import *
import C3toolbox
import sys
import os
sys.argv=["Main"]
import tkinter
global instrument_var
global expression_var
global fldRowTxt
global form
def execute(selected):
global instrument_var
global expression_var
global fldRowTxt
global form
grid_array = { "1/16" : "s", "1/32" : "t", "1/64" : "f" }
instrument = str(instrument_var.get())
expression = str(expression_var.get())
grid = grid_array[expression]
instrument = C3toolbox.array_instruments[instrument]
if instrument == "PART REAL_KEYS":
instrument = "PART REAL_KEYS_X"
tolerance = str(fldRowTxt.get())
C3toolbox.startup()
C3toolbox.polish_notes(instrument, grid, int(tolerance), selected) #instrument, grid, tolerance, selected
form.destroy()
def launch():
global instrument_var
global expression_var
global fldRowTxt
global form
C3toolbox.startup()
form = tkinter.Tk()
form.wm_title('Polish notes')
instrument_name = C3toolbox.get_trackname()
if instrument_name in C3toolbox.array_dropdownid:
instrument_id = C3toolbox.array_dropdownid[instrument_name]
else:
instrument_id = 0
helpLf = tkinter.Frame(form)
helpLf.grid(row=0, column=1, sticky='NS', padx=5, pady=5)
inFileLbl = tkinter.Label(helpLf, text="Select instrument")
inFileLbl.grid(row=0, column=1, columnspan=2, sticky='E', padx=5, pady=2)
OPTIONS = ["Drums", "Guitar", "Bass", "Keys", "Pro Keys", "2x Drums", "Rhythm"]
if instrument_id >= len(OPTIONS):
instrument_id = 0
instrument_var = tkinter.StringVar(helpLf)
instrument_var.set(OPTIONS[instrument_id]) # default value
instrumentOpt = tkinter.OptionMenu(*(helpLf, instrument_var) + tuple(OPTIONS))
instrumentOpt.grid(row=0, column=3, columnspan=2, sticky="WE", pady=3)
expressionLbl = tkinter.Label(helpLf, text="Select grid")
expressionLbl.grid(row=0, column=5, columnspan=2, sticky='E', padx=5, pady=2)
OPTIONS = ["1/16", "1/32", "1/64"]
expression_var = tkinter.StringVar(helpLf)
expression_var.set(OPTIONS[1]) # default value
expressionOpt = tkinter.OptionMenu(*(helpLf, expression_var) + tuple(OPTIONS))
expressionOpt.grid(row=0, column=7, sticky="WE", pady=3)
fldLbl = tkinter.Label(helpLf, \
text="Snap to grid notes off by +/- this or less:")
fldLbl.grid(row=1, column=1, columnspan=6, padx=5, pady=2, sticky='E')
var = tkinter.StringVar()
fldRowTxt = tkinter.Entry(helpLf, textvariable=var)
var.set('20')
fldRowTxt.grid(row=1, column=7, padx=5, pady=2, sticky='W')
allBtn = tkinter.Button(helpLf, text="Polish all notes", command= lambda: execute(0))
allBtn.grid(row=0, column=8, sticky="WE", padx=5, pady=2)
allBtn = tkinter.Button(helpLf, text="Polish selected notes", command= lambda: execute(1))
allBtn.grid(row=1, column=8, sticky="WE", padx=5, pady=2)
logo = tkinter.Frame(form, bg="#000")
logo.grid(row=2, column=0, columnspan=10, sticky='WE', \
padx=0, pady=0, ipadx=0, ipady=0)
path = os.path.join( sys.path[0], "banner.gif" )
img = tkinter.PhotoImage(file=path)
imageLbl = tkinter.Label(logo, image = img, borderwidth=0)
imageLbl.grid(row=0, column=0, rowspan=2, sticky='E', padx=0, pady=0)
form.mainloop()
if __name__ == '__main__':
launch()
#C3toolbox.startup()
#C3toolbox.polish_notes("PART VOCALS", "t", 20, 0)