def __init__(self, master, param, editor): """ Create new OscFrequencyControl object. Widgets are not automatically added to the Tk master. Call the layout method to place widgets using a default layout. ARGS: param - String, SC synth parameter. editor - An instance of TkSubEditor master - Tk container. """ print("DEPRECIATION WARNING: OscFrequencyControl") super(OscFrequencyControl, self).__init__(param, editor, master) octaves = [(3, "+3"),(2, "+2"),(1, "+1"),(0, " 0"), (-1,"-1"),(-2,"-2"),(-3,"-3")] self.var_octave = tk.StringVar() # Octave number -3 ... +3 self.var_transpose = tk.IntVar() # Transpose steps, 0 ... 11 self.var_detune = tk.IntVar() # Detune in cents 0 ... 99 self.var_zero = tk.IntVar() # 0 -> osc != 0, 1 -> osc freq = 0 self.var_octave.set(0) self.var_transpose.set(0) self.var_detune.set(0) self.var_zero.set(0) self._radio_buttons = [] for value, text in octaves: rb = factory.radio(master, text, self.var_octave, value, command = self.callback, ttip = "%s octave" % param) widget_key = "radio-octave-%d" % value self._widgets[widget_key] = rb self._radio_buttons.append(rb) rb.bind("<Enter>", self.enter_callback) s_step = factory.scale(master, from_=11, to=0, var = self.var_transpose, command = self.callback, ttip = "%s transpose (steps)" % param) s_detune = factory.scale(master, from_=99, to=0, var = self.var_detune, command=self.callback, ttip = "%s detune (cents)" % param) cb_zero = factory.checkbutton(master, "Off") cb_zero.config(command=self.callback,var = self.var_zero) ## Labels lab_transpose = factory.label(master, "00") lab_detune = factory.label(master, "000") lab_value = factory.label(master, "1.0000") self._widgets["scale-transpose"] = s_step self._widgets["scale-detune"] = s_detune self._widgets["checkbutton-zero"] = cb_zero self._widgets["label-transpose"] = lab_transpose self._widgets["label-detune"] = lab_detune self._widgets["label-value"] = lab_value self._editor = editor self._param = param s_step.bind("<Enter>", self.enter_callback) s_detune.bind("<Enter>", self.enter_callback)
def __init__(self, master, param, editor, curves=(None, None), domain=(200,0), orientation="vertical", ttip=""): """ Constructs ControlSlider master - Tk component to contain this control param - String, synth parameter editor - TkSubEditor curves - A tuple (a,b) of transformation functions. These functions transform slider position to parameter values and the inverse parameter to slider position. The defaults are a = llia.gui.abstract_control.norm_to_aspect b = llia.gui.abstract_control.aspect_to_norm domain - Tuple, the number of slider positions (high, low) default (200,0) orientation - string, either "vertical" or "horizontal" The default is vertical. ttip - String, tool tip text, DEPRECIATED """ self._tkscale = factory.scale(master, from_=domain[0], to=domain[1], command = self.callback, ttip=ttip) super(ControlSlider, self).__init__(param, editor, self._tkscale) self._primary_widget = self._tkscale self.value_to_aspect_transform = curves[0] or absctrl.norm_to_aspect self.aspect_to_value_transform = curves[1] or absctrl.aspect_to_norm self.client_callback = ControlSlider.default_client_callback self._tkscale.bind("<Enter>", self.enter_callback) self._editor = editor self._param = param
def __init__(self, master, param, editor, include_off=False, ttip=""): octaves = [(3, "+3"), (2, "+2"), (1, "+1"), (0, " 0"), (-1, "-1"), (-2, "-2"), (-3, "-3")] if include_off: octaves.append((ZERO_FREQ, "Off")) frame = factory.frame(master) super(OscFrequencyControl, self).__init__(param, editor, frame) self.var_octave = tk.StringVar() self.var_octave.set(0) row = 1 for value, text in octaves: rb = factory.radio(frame, text, self.var_octave, value, ttip, command=self.callback) widget_key = "radio_coarse_%s" % value self._widgets[widget_key] = rb rb.grid(row = row, column=0, sticky="w") row += 1 self.scale_fine = factory.scale(frame, command=self.callback, ttip="Fine Frequency Scale") self.scale_fine.grid(row=1, column=1, rowspan=row) self.lab_freq = factory.label(frame, "X.XXXX") self.lab_freq.grid(row=row+1, column=0, columnspan=2)
def __init__(self, master, param, editor, range_ = 1000, degree = 2, clip = None): super(ReciprocalSlider, self).__init__(param, editor, master) r = (1.0/range_,range_) self.degree = degree self.inv_degree = 1.0/degree self.range_ = r if clip: self._clip = clip else: self._clip = self.range_ self.var_aspect = tk.StringVar() self.var_sign = tk.IntVar() self.var_invert = tk.IntVar() self.var_aspect.set(self._clip[0]) self.var_sign.set(0) self.var_invert.set(0) s = factory.scale(master, from_ = 1, to=0, resolution = 0.005, command= self.callback, var = self.var_aspect) cb_sign = factory.checkbutton(master, "-", self.var_sign, command = self.callback) cb_invert = factory.checkbutton(master, "1/n", self.var_invert, command = self.callback) self._widgets["slider"] = s self._widgets["checkbutton-sign"] = cb_sign self._widgets["checkbutton-invert"] = cb_invert self._editor = editor self._param = param s.bind("<Enter>", self.enter_callback)
def _layout_env_time(self, master): var = Tkinter.StringVar() frame = factory.frame(master) frame.grid(row=1,column=3,sticky='n',padx=8) def select(n): rndgen.gen_config["env-time-hint"] = n rb_random = factory.radio(frame,"Random",var,7, command=lambda : select(None)) rb_ufast = factory.radio(frame,"Ultra Fast",var,ULTRA_FAST, command=lambda : select(ULTRA_FAST)) rb_fast = factory.radio(frame,"Fast",var,FAST, command=lambda : select(FAST)) rb_med = factory.radio(frame,"Medium",var,MEDIUM, command=lambda : select(MEDIUM)) rb_slow = factory.radio(frame,"Slow",var,SLOW, command=lambda : select(SLOW)) rb_glac = factory.radio(frame,"Glacial",var,GLACIAL, command=lambda : select(GLACIAL)) lab = factory.label(frame,"Envelope Times") lab.grid(row=0,column=0,sticky='w') rb_random.grid(row=1,column=0,sticky='w') rb_ufast.grid(row=2,column=0,sticky='w') rb_fast.grid(row=3,column=0,sticky='w') rb_med.grid(row=4,column=0,sticky='w') rb_slow.grid(row=5,column=0,sticky='w') rb_glac.grid(row=6,column=0,sticky='w') self._var_env_changeup = Tkinter.StringVar() s = factory.scale(frame,from_=100,to=0, var = self._var_env_changeup, command=self._env_changeup_callback) lab = factory.label(frame,"Env Changeup") lab.grid(row=0,column=1,sticky='ew',padx=16) s.grid(row=1,column=1,rowspan=6,sticky='ns')
def __init__(self, master, param, editor, coarse = (0.001, 1000), limit = (0.001, 9999)): """ Constructs new DecadeControl object. ARGS: master - The TK master widget for these components. param - String, synth parameter. editor - An instance of TkSubEditor coarse - Tuple (a, b) sets range of coarse controls. a and b must both be powers of 10 with a < b. A radio button is created for each power of 10 between a and b. limit - Tuple (mn, mx), sets minimum and maximum value. """ print("DEPRECIATION WARNING: DecadeCounter") super(DecadeControl, self).__init__(param, editor, master) self._min_value, self._max_value = limit start, end = coarse start, end = min(start, end), max(start, end) decades = [] value = start while value <= end: power = log10(value) if power == 0: txt = "1" elif power < 1: txt = "1/%d" % int(10**abs(power)) else: txt = str(int(10**power)) decades.append((value, txt)) value *= 10 decades.reverse() self.var_decade = tk.StringVar() self.var_scale = tk.IntVar() self.var_decade.set(start) self.var_scale.set(1) self._radio_buttons = [] for value, txt in decades: rb = factory.radio(master, txt, self.var_decade, value, command=self.callback, ttip = "%s range" % param) widget_key = "radio-range-%d" % value self._widgets[widget_key] = rb self._radio_buttons.append(rb) rb.bind("<Enter>", self.enter_callback) s_scale = factory.scale(master, from_=90, to=0, var = self.var_scale, command = self.callback, ttip = "%s scale" % param) s_scale.bind("<Enter>", self.enter_callback) self._widgets["slider"] = s_scale lab_value = factory.label(master, "X.XXX") self._widgets["label-value"] = lab_value self._editor = editor self._param = param
def __init__(self, master, param, editor, curves=(None, None), domain=(200,0), orientation="vertical", ttip=""): self._tkscale = factory.scale(master, from_=domain[0], to=domain[1], command = self.callback, ttip=ttip) super(ControlSlider, self).__init__(param, editor, self._tkscale) self._primary_widget = self._tkscale self.value_to_aspect_transform = curves[0] or absctrl.norm_to_aspect self.aspect_to_value_transform = curves[1] or absctrl.aspect_to_norm self.client_callback = ControlSlider.default_client_callback self._tkscale.bind("<Enter>", self.enter_callback) self._editor = editor self._param = param
def _layout_slider_panel(self,master): frame = factory.frame(master) frame.grid(row=1,column=4,sticky='n',padx=8) self._var_harmonic = Tkinter.StringVar() self._var_deepmod = Tkinter.StringVar() self._var_feedback = Tkinter.StringVar() lab = factory.label(frame,"Harmonic") lab.grid(row=0,column=0,sticky='ew',padx=16) lab = factory.label(frame,"Modulation") lab.grid(row=0,column=1,sticky='ew',padx=16) lab = factory.label(frame,"Feedback") lab.grid(row=0,column=2,sticky='ew',padx=16) sh = factory.scale(frame,from_=100,to=0, var = self._var_harmonic, command = self._harmonic_callback) sm = factory.scale(frame,from_=100,to=0, var = self._var_deepmod, command = self._deepmod_callback) sf = factory.scale(frame,from_=100,to=0, var = self._var_feedback, command = self._feedback_callback) sh.grid(row=1,column=0,rowspan=6,sticky='ns') sm.grid(row=2,column=1,rowspan=6,sticky='ns') sf.grid(row=3,column=2,rowspan=6,sticky='ns')
def __init__(self, master, param, editor, range_=1000, degree=2, clip=None, ttip=""): """ Construct new ExpSlider object. ARGS: master - The parent Tk container. param - String, synth parameter. editor - An instance of TkSubEditor range_ - Float or Int, the maximum value magnitude. The minimum magnitude is always 0. degree - Positive Int of Float, The exponential degree. ttip - String, tool tip text. """ super(ExpSlider, self).__init__(param, editor, master) self.degree = degree self.inv_degree = 1.0 / degree if clip: self._clip = clip else: self._clip = (0, range_) self.var_aspect = tk.StringVar() self.var_sign = tk.IntVar() self.var_aspect.set(0.0) self.var_sign.set(0) self.range_ = [0, range_] ttip = ttip or "%s" % param s = factory.scale(master, from_=1.0, to=0.0, resolution=0.005, command=self.callback, var=self.var_aspect, ttip=ttip) cb = factory.checkbutton(master, "Inv", self.var_sign, command=self.callback) self._widgets["slider"] = s self._widgets["checkbutton-sign"] = cb self._editor = editor self._param = param s.bind("<Enter>", self.enter_callback)
def __init__(self, master, param, editor, range_ = 1000, degree = 2, clip=None, ttip=""): """ Construct new ExpSlider object. ARGS: master - The parent Tk container. param - String, synth parameter. editor - An instance of TkSubEditor range_ - Float or Int, the maximum value magnitude. The minimum magnitude is always 0. degree - Positive Int of Float, The exponential degree. ttip - String, tool tip text. """ super(ExpSlider, self).__init__(param, editor, master) self.degree = degree self.inv_degree = 1.0/degree if clip: self._clip = clip else: self._clip = (0, range_) self.var_aspect = tk.StringVar() self.var_sign = tk.IntVar() self.var_aspect.set(0.0) self.var_sign.set(0) self.range_ = [0,range_] ttip = ttip or "%s" % param s = factory.scale(master, from_ = 1.0, to=0.0, resolution = 0.005, command = self.callback, var=self.var_aspect, ttip=ttip) cb = factory.checkbutton(master, "Inv", self.var_sign, command = self.callback) self._widgets["slider"] = s self._widgets["checkbutton-sign"] = cb self._editor = editor self._param = param s.bind("<Enter>", self.enter_callback)
def __init__(self, master, param, editor, coarse=(0.001, 1000), limit=(0.001, 9999)): """ Constructs new DecadeControl object. ARGS: master - The TK master widget for these components. param - String, synth parameter. editor - An instance of TkSubEditor coarse - Tuple (a, b) sets range of coarse controls. a and b must both be powers of 10 with a < b. A radio button is created for each power of 10 between a and b. limit - Tuple (mn, mx), sets minimum and maximum value. """ print("DEPRECIATION WARNING: DecadeCounter") super(DecadeControl, self).__init__(param, editor, master) self._min_value, self._max_value = limit start, end = coarse start, end = min(start, end), max(start, end) decades = [] value = start while value <= end: power = log10(value) if power == 0: txt = "1" elif power < 1: txt = "1/%d" % int(10**abs(power)) else: txt = str(int(10**power)) decades.append((value, txt)) value *= 10 decades.reverse() self.var_decade = tk.StringVar() self.var_scale = tk.IntVar() self.var_decade.set(start) self.var_scale.set(1) self._radio_buttons = [] for value, txt in decades: rb = factory.radio(master, txt, self.var_decade, value, command=self.callback, ttip="%s range" % param) widget_key = "radio-range-%d" % value self._widgets[widget_key] = rb self._radio_buttons.append(rb) rb.bind("<Enter>", self.enter_callback) s_scale = factory.scale(master, from_=90, to=0, var=self.var_scale, command=self.callback, ttip="%s scale" % param) s_scale.bind("<Enter>", self.enter_callback) self._widgets["slider"] = s_scale lab_value = factory.label(master, "X.XXX") self._widgets["label-value"] = lab_value self._editor = editor self._param = param
def __init__(self, master, param, editor): """ Create new OscFrequencyControl object. Widgets are not automatically added to the Tk master. Call the layout method to place widgets using a default layout. ARGS: param - String, SC synth parameter. editor - An instance of TkSubEditor master - Tk container. """ print("DEPRECIATION WARNING: OscFrequencyControl") super(OscFrequencyControl, self).__init__(param, editor, master) octaves = [(3, "+3"), (2, "+2"), (1, "+1"), (0, " 0"), (-1, "-1"), (-2, "-2"), (-3, "-3")] self.var_octave = tk.StringVar() # Octave number -3 ... +3 self.var_transpose = tk.IntVar() # Transpose steps, 0 ... 11 self.var_detune = tk.IntVar() # Detune in cents 0 ... 99 self.var_zero = tk.IntVar() # 0 -> osc != 0, 1 -> osc freq = 0 self.var_octave.set(0) self.var_transpose.set(0) self.var_detune.set(0) self.var_zero.set(0) self._radio_buttons = [] for value, text in octaves: rb = factory.radio(master, text, self.var_octave, value, command=self.callback, ttip="%s octave" % param) widget_key = "radio-octave-%d" % value self._widgets[widget_key] = rb self._radio_buttons.append(rb) rb.bind("<Enter>", self.enter_callback) s_step = factory.scale(master, from_=11, to=0, var=self.var_transpose, command=self.callback, ttip="%s transpose (steps)" % param) s_detune = factory.scale(master, from_=99, to=0, var=self.var_detune, command=self.callback, ttip="%s detune (cents)" % param) cb_zero = factory.checkbutton(master, "Off") cb_zero.config(command=self.callback, var=self.var_zero) ## Labels lab_transpose = factory.label(master, "00") lab_detune = factory.label(master, "000") lab_value = factory.label(master, "1.0000") self._widgets["scale-transpose"] = s_step self._widgets["scale-detune"] = s_detune self._widgets["checkbutton-zero"] = cb_zero self._widgets["label-transpose"] = lab_transpose self._widgets["label-detune"] = lab_detune self._widgets["label-value"] = lab_value self._editor = editor self._param = param s_step.bind("<Enter>", self.enter_callback) s_detune.bind("<Enter>", self.enter_callback)