Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
 def _layout_engion_selection(self, master):
     var = Tkinter.StringVar()
     frame = factory.frame(master)
     frame.grid(row=1,column=1,sticky='n',padx=8)
     rb_gen_random = factory.radio(frame,"Random",
                                   var,"Random",
                                   command = lambda : rndgen.set_engion("random"))
     rb_gen_basic = factory.radio(frame,"Basic",
                                  var,"Basic",
                                  command = lambda : rndgen.set_engion("basic"))
     rb_gen_chorus = factory.radio(frame,"Chorus",
                                  var,"Chorus",
                                  command = lambda : rndgen.set_engion("chorus"))
     lab = factory.label(frame,"Engion")
     lab.grid(row=0,column=0,sticky='w')
     rb_gen_random.grid(row=1,column=0,sticky='w')
     rb_gen_basic.grid(row=2,column=0,sticky='w')
     rb_gen_chorus.grid(row=3,column=0,sticky='w')
Esempio n. 4
0
 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
Esempio n. 5
0
 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)
Esempio n. 6
0
 def __init__(self, master, param, editor, values):
     super(DiscreateControl, self).__init__(param, editor, master)
     self.var_value = tk.StringVar()
     self.var_value.set(values[0][0])
     self.radio_buttons = []
     for value, text in values:
         rb = factory.radio(master, text, self.var_value, value,
                            command=self.callback,
                            ttip = param)
         widget_key = "radio-%s" % value
         self.radio_buttons.append(rb)
         self._widgets[widget_key] = rb
Esempio n. 7
0
 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')
Esempio n. 8
0
 def __init__(self, master, param, editor, values):
     super(DiscreateControl, self).__init__(param, editor, master)
     self.var_value = tk.StringVar()
     self.var_value.set(values[0][0])
     self.radio_buttons = []
     for value, text in values:
         rb = factory.radio(master,
                            text,
                            self.var_value,
                            value,
                            command=self.callback,
                            ttip=param)
         widget_key = "radio-%s" % value
         self.radio_buttons.append(rb)
         self._widgets[widget_key] = rb
Esempio n. 9
0
 def _layout_env_type(self, master):
     var = Tkinter.StringVar()
     frame = factory.frame(master)
     frame.grid(row=1,column=2,sticky='n',padx=8)
     def select(n):
         rndgen.gen_config["env-type-hint"] = n
     rb_random = factory.radio(frame,"Random",var,5,
                               command = lambda : select(None))
     rb_gate = factory.radio(frame,"Gate",var,GATE,
                             command = lambda : select(GATE))
     rb_perc = factory.radio(frame,"Percussive",var,PERCUSSIVE,
                             command = lambda : select(PERCUSSIVE))
     rb_asr = factory.radio(frame,"ASR",var,ASR,
                            command = lambda : select(ASR))
     rb_adsr = factory.radio(frame,"ADSR",var,ADSR,
                             command = lambda : select(ADSR))
    
     lab = factory.label(frame,"Envelope Type")
     lab.grid(row=0,column=0,sticky='w')
     rb_random.grid(row=1,column=0,sticky='w')
     rb_gate.grid(row=2,column=0,sticky='w')
     rb_perc.grid(row=3,column=0,sticky='w')
     rb_asr.grid(row=4,column=0,sticky='w')
     rb_adsr.grid(row=5,column=0,sticky='w')
Esempio n. 10
0
 def _build_south_panel(self, south):
     self._midi_input_ports = mido.get_input_names()
     self._midi_output_ports = mido.get_output_names()
     port_rows = max(len(self._midi_input_ports),
                     len(self._midi_output_ports))
     init_id = self.config.global_osc_id()
     init_host = self.config["host"]
     init_port = self.config["port"]
     init_client = self.config["client"]
     init_client_port = self.config["client_port"]
     init_input = self.config["midi-receiver-name"]
     init_output = self.config["midi-transmitter-name"]
     self.var_id = StringVar()
     self.var_host = StringVar()
     self.var_port = StringVar()
     self.var_client = StringVar()
     self.var_client_port = StringVar()
     self.var_input = StringVar()
     self.var_output = StringVar()
     def restore_defaults():
         self.var_id.set(init_id)
         self.var_host.set(init_host)
         self.var_port.set(init_port)
         self.var_client.set(init_client)
         self.var_client_port.set(init_client_port)
         self.var_input.set(init_input)
         self.var_output.set(init_output)
     restore_defaults()
     e_id = factory.entry(south, self.var_id)
     e_host = factory.entry(south, self.var_host)
     e_port = factory.entry(south, self.var_port)
     e_client = factory.entry(south, self.var_client)
     e_client_port = factory.entry(south, self.var_client_port)
     #factory.padding_label(south).grid(row=0, column=0, ipadx=8, ipady=8)
     e_id.grid(row=1, column=1, columnspan=2)
     e_host.grid(row=2, column=1, columnspan=2)
     e_port.grid(row=2, column=5, columnspan=2)
     e_client.grid(row=3, column=1, columnspan=2)
     e_client_port.grid(row=3, column=5, columnspan=2)
     port_count = max(len(self._midi_input_ports),
                      len(self._midi_output_ports))
     lab_id = factory.label(south, "OSC ID")
     lab_host = factory.label(south, "Host")
     lab_host_port = factory.label(south, "Port")
     lab_client = factory.label(south, "Client")
     lab_client_port = factory.label(south, "Port")
     lab_midi_input = factory.label(south, "MIDI Input")
     lab_midi_output = factory.label(south, "MIDI Output")
     # factory.padding_label(south).grid(row=4, column=3, ipadx=8, ipady=8)
     lab_id.grid(row=1, column=0, columnspan=1, ipadx=8, ipady=8)
     lab_host.grid(row=2, column=0, columnspan=1)
     lab_host_port.grid(row=3, column=4, columnspan=1, ipadx=4)
     lab_client.grid(row=3, column=0, columnspan=1)
     lab_client_port.grid(row=3, column=4, columnspan=1)
     lab_midi_input.grid(row=5, column=1, columnspan=2, ipady=8)
     lab_midi_output.grid(row=5, column=5, columnspan=2, ipady=8)
     for n,p in enumerate(self._midi_input_ports):
         rb = factory.radio(south, str(p), self.var_input, str(p))
         rb.grid(row=n+6, column=1, sticky="W")
     for n,p in enumerate(self._midi_output_ports):
         rb = factory.radio(south, str(p), self.var_output, str(p))
         rb.grid(row=n+6, column=5, sticky="W")
     factory.padding_label(south).grid(row=0, column=7, ipadx=36)
     #b_restore = factory.button(south, "Restore", command=restore_defaults)
     b_continue = factory.button(south, "Continue", command=self.accept)
     b_help = factory.help_button(south)
     b_help.config(command=self.display_help)
     row = port_count + 6
     #b_restore.grid(row=row, column=1, sticky="EW", pady=16)
     b_continue.grid(row=row, column=1, sticky="EW", pady=16)
     b_help.grid(row=row, column=3, padx=8, sticky="W")
     self.lab_warning = factory.label(south, "")
     self.lab_warning.config(foreground=factory.pallet("warning-fg"))
     self.lab_warning.grid(row=6, column=7, sticky="EW",
                           columnspan=2, rowspan=4)
Esempio n. 11
0
 def __init__(self, master, synth, src, app):
     Toplevel.__init__(self, master)
     self.src = src
     self.synth = synth
     self.app = app
     self.var_curve = StringVar()
     self.var_modifier = StringVar()
     self.var_range_low = StringVar()
     self.var_range_high = StringVar()
     self.var_limit_low = StringVar()
     self.var_limit_high = StringVar()
     self.var_curve.set("linear")
     self.var_modifier.set("1.0")
     self.var_range_low.set("0.0")
     self.var_range_high.set("1.0")
     self.var_limit_low.set("0.0")
     self.var_limit_high.set("1.0")
     frame = factory.frame(self, modal=True)
     frame.pack(expand=True, fill="both")
     lab_title = factory.label(frame, "Add MIDI Source Map", modal=True)
     lab_title.grid(row=0, column=0, columnspan=4, padx=4, pady=8)
     if src == "cc":
         lab_src1 = factory.label(frame, "Controller", modal=True)
         self.combo_source = factory.controller_combobox(frame, app)
         lab_src1.grid(row=1, column=0, sticky="w", padx=4)
         self.combo_source.grid(row=1, column=1)
     else:
         lab_src1 = factory.label(frame, "Source", modal=True)
         lab_src2 = factory.label(frame, src, modal=True)
         self.combo_source = factory.combobox(None, [src])  # Hidden
         lab_src1.grid(row=1, column=0, sticky="w", padx=4)
         lab_src2.grid(row=1, column=1, sticky="w")
     lab_params = factory.label(frame, "Params", modal=True)
     bnk = synth.bank()
     params = sorted(bnk.template.keys())
     self.combo_params = factory.combobox(frame, params, 
                                          "Synth parameters")
     frame_curve = factory.label_frame(frame, "Curve", modal=True)
     for i, c in enumerate((("Linear", "linear"), 
                            ("Exponential","exp"), 
                            ("Logistic (S)", "s"), 
                            ("Step","step"))):
         rb = factory.radio(frame_curve, c[0], self.var_curve, c[1], 
                            modal=True)
         rb.config(command=self._auto_modifier_callback)
         rb.grid(row=i, column=0, columnspan=2, sticky="w", padx=4)
     lab_modifier = factory.label(frame_curve, "Modifier", modal=True)
     spin_modifier = factory.float_spinbox(frame_curve, 
                                           self.var_modifier, 
                                           -10, 10, "Curve modifier")
     lab_modifier.grid(row=4, column=0, padx=4, pady=8, sticky="w")
     spin_modifier.grid(row=4, column=1)
     frame_range = factory.label_frame(frame, "Range", modal=True)
     lab_low = factory.label(frame_range, "Low", modal=True)
     lab_high = factory.label(frame_range, "High", modal=True)
     spin_range_low = factory.float_spinbox(frame_range, 
                                            self.var_range_low, -100, 100)
     spin_range_low.config(command=self._auto_limit_callback)
     spin_range_high = factory.float_spinbox(frame_range, 
                                             self.var_range_high, -100, 100)
     spin_range_high.config(command=self._auto_limit_callback)
     lab_low.grid(row=0, column=0, sticky="w", padx=4)
     spin_range_low.grid(row=0, column=1, sticky="ew")
     lab_high.grid(row=1, column=0, sticky="w", padx=4)
     spin_range_high.grid(row=1, column=1, sticky="ew")
     frame_limit = factory.label_frame(frame, "Limit", modal=True)
     lab_low = factory.label(frame_limit, "Low", modal=True)
     lab_high = factory.label(frame_limit, "High", modal=True)
     spin_limit_low = factory.float_spinbox(frame_limit, 
                                            self.var_limit_low, -100, 100)
     spin_limit_high = factory.float_spinbox(frame_limit, 
                                             self.var_limit_high, -100, 100)
     lab_low.grid(row=0, column=0, sticky="w", padx=4)
     spin_limit_low.grid(row=0, column=1, sticky="ew")
     lab_high.grid(row=1, column=0, sticky="w", padx=4)
     spin_limit_high.grid(row=1, column=1, sticky="ew")
     toolbar = factory.frame(frame, modal=True)
     b_help = factory.help_button(toolbar,command=self.help_callback)
     b_restore = factory.clear_button(toolbar, ttip="Restore defaults", 
                                      command=self.restore_callback)
     b_accept = factory.accept_button(toolbar, 
                                      command=self.accept_callback)
     b_cancel = factory.cancel_button(toolbar, 
                                      command=self.cancel_callback)
     b_help.grid(row=0, column=0, sticky="ew")
     b_restore.grid(row=0, column=1, sticky="ew")
     b_accept.grid(row=0, column=2, sticky="ew")
     b_cancel.grid(row=0, column=3, sticky="ew")
     lab_params.grid(row=2, column=0, padx=4, sticky="w")
     self.combo_params.grid(row=2, column=1)
     frame_curve.grid(row=3, column=0, columnspan=2, 
                      padx=4, pady=8, sticky="ew")
     frame_range.grid(row=4, column=0, columnspan=2, 
                      padx=4, pady=4, sticky="ew")
     frame_limit.grid(row=5, column=0, columnspan=2, 
                      padx=4, pady=4, sticky="ew")
     toolbar.grid(row=6, column=0, columnspan=4, 
                  padx=4, pady=8, sticky="ew")
     if src == "cc":
         index = self.get_default_controller(synth)
         if is_string(index):
             index = int(index[1:4])
         self.combo_source.current(index)
     index = self.get_default_param(synth)
     self.combo_params.set(index)
Esempio n. 12
0
    def _build_south_panel(self, south):
        self._midi_input_ports = mido.get_input_names()
        self._midi_output_ports = mido.get_output_names()
        port_rows = max(len(self._midi_input_ports),
                        len(self._midi_output_ports))
        init_id = self.config.global_osc_id()
        init_host = self.config["host"]
        init_port = self.config["port"]
        init_client = self.config["client"]
        init_client_port = self.config["client_port"]
        init_input = self.config["midi-receiver-name"]
        init_output = self.config["midi-transmitter-name"]
        self.var_id = StringVar()
        self.var_host = StringVar()
        self.var_port = StringVar()
        self.var_client = StringVar()
        self.var_client_port = StringVar()
        self.var_input = StringVar()
        self.var_output = StringVar()

        def restore_defaults():
            self.var_id.set(init_id)
            self.var_host.set(init_host)
            self.var_port.set(init_port)
            self.var_client.set(init_client)
            self.var_client_port.set(init_client_port)
            self.var_input.set(init_input)
            self.var_output.set(init_output)

        restore_defaults()
        e_id = factory.entry(south, self.var_id)
        e_host = factory.entry(south, self.var_host)
        e_port = factory.entry(south, self.var_port)
        e_client = factory.entry(south, self.var_client)
        e_client_port = factory.entry(south, self.var_client_port)
        #factory.padding_label(south).grid(row=0, column=0, ipadx=8, ipady=8)
        e_id.grid(row=1, column=1, columnspan=2)
        e_host.grid(row=2, column=1, columnspan=2)
        e_port.grid(row=2, column=5, columnspan=2)
        e_client.grid(row=3, column=1, columnspan=2)
        e_client_port.grid(row=3, column=5, columnspan=2)
        port_count = max(len(self._midi_input_ports),
                         len(self._midi_output_ports))
        lab_id = factory.label(south, "OSC ID")
        lab_host = factory.label(south, "Host")
        lab_host_port = factory.label(south, "Port")
        lab_client = factory.label(south, "Client")
        lab_client_port = factory.label(south, "Port")
        lab_midi_input = factory.label(south, "MIDI Input")
        lab_midi_output = factory.label(south, "MIDI Output")
        # factory.padding_label(south).grid(row=4, column=3, ipadx=8, ipady=8)
        lab_id.grid(row=1, column=0, columnspan=1, ipadx=8, ipady=8)
        lab_host.grid(row=2, column=0, columnspan=1)
        lab_host_port.grid(row=3, column=4, columnspan=1, ipadx=4)
        lab_client.grid(row=3, column=0, columnspan=1)
        lab_client_port.grid(row=3, column=4, columnspan=1)
        lab_midi_input.grid(row=5, column=1, columnspan=2, ipady=8)
        lab_midi_output.grid(row=5, column=5, columnspan=2, ipady=8)
        for n, p in enumerate(self._midi_input_ports):
            rb = factory.radio(south, str(p), self.var_input, str(p))
            rb.grid(row=n + 6, column=1, sticky="W")
        for n, p in enumerate(self._midi_output_ports):
            rb = factory.radio(south, str(p), self.var_output, str(p))
            rb.grid(row=n + 6, column=5, sticky="W")
        factory.padding_label(south).grid(row=0, column=7, ipadx=36)
        #b_restore = factory.button(south, "Restore", command=restore_defaults)
        b_continue = factory.button(south, "Continue", command=self.accept)
        b_help = factory.help_button(south)
        b_help.config(command=self.display_help)
        row = port_count + 6
        #b_restore.grid(row=row, column=1, sticky="EW", pady=16)
        b_continue.grid(row=row, column=1, sticky="EW", pady=16)
        b_help.grid(row=row, column=3, padx=8, sticky="W")
        self.lab_warning = factory.label(south, "")
        self.lab_warning.config(foreground=factory.pallet("warning-fg"))
        self.lab_warning.grid(row=6,
                              column=7,
                              sticky="EW",
                              columnspan=2,
                              rowspan=4)
Esempio n. 13
0
 def __init__(self, master, app, synth_type, is_efx=False, is_controller=False):
     Toplevel.__init__(self, master)
     main = factory.frame(self)
     main.pack(anchor=W, expand=True, fill=BOTH)
     self.app = app
     self.stype = synth_type
     self.is_efx = is_efx
     self.is_controller = is_controller
     sid = "%s_%d" % (synth_type, SynthProxy.current_synth_serial_number())
     specs = SynthSpecs.global_synth_type_registry[synth_type]
     self._combo_audio_in = {}    # Maps synth parameter to combo box
     self._combo_audio_out = {}
     self._combo_control_in = {}
     self._combo_control_out = {}
     self._buffername_map = {}
     title = "Add %s " % synth_type
     if is_efx:
         title += "Effect"
     elif is_controller:
         title += "Controller Synth"
     else:
         title += "Synth"
     title += "      sid = %s" % sid
     frame_north = factory.frame(main)
     frame_north.grid(row=0, column=0, columnspan=2, sticky='ew', padx=4, pady=8)
     logo_filename = os.path.join("resources", synth_type, "logo_small.png")
     lab_logo = factory.image_label(frame_north, logo_filename, synth_type)
     lab_id = factory.dialog_title_label(frame_north, title)
     lab_logo.grid(row=0, column=0, padx=8)
     lab_id.grid(row=0, column=1)
     # Audio Input Buses
     frame_audio_in = factory.label_frame(main, "Audio Input Buses")
     row = 0
     for i in range(MAX_BUS_COUNT):
         try:
             b = specs["audio-input-buses"][i]
             param = b[0]
             lab_name = factory.label(frame_audio_in, "%d - %s" % (i+1, param))
             combo = factory.audio_bus_combobox(frame_audio_in, self.app)
             combo.set(b[1])
             lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4)
             combo.grid(row=row, column=1, sticky="w", padx=4, pady=4)
             self._combo_audio_in[param] = combo
         except IndexError:
             lab_dummy = factory.label(frame_audio_in, "%d - n/a" % (i+1, ))
             lab_dummy.grid(row=row, column=0)
         row += 1
     factory.padding_label(frame_audio_in).grid(row=row, column=0)
     frame_audio_in.grid(row=1, column=0, padx=4, pady=4, sticky='ew')
     # Audio Output Buses
     frame_audio_out = factory.label_frame(main, "Audio Output Buses")
     row = 0
     for i in range(MAX_BUS_COUNT):
         try:
             b = specs["audio-output-buses"][i]
             param = b[0]
             lab_name = factory.label(frame_audio_out, "%d - %s" % (i+1, param))
             combo = factory.audio_bus_combobox(frame_audio_out, self.app)
             combo.set(b[1])
             lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4)
             combo.grid(row=row, column=1, sticky="w", padx=4, pady=4)
             self._combo_audio_out[param] = combo
         except IndexError:
             lab_dummy = factory.label(frame_audio_out, "%d - n/a" % (i+1,))
             lab_dummy.grid(row=row, column=0)
         row += 1
     factory.padding_label(frame_audio_out).grid(row=row, column=0)
     frame_audio_out.grid(row=5, column=0, padx=4, pady=4, sticky='ew')
     # Control Input Buses
     frame_control_in = factory.label_frame(main, "Control Input Buses")
     row = 0
     for i in range(MAX_BUS_COUNT):
         try:
             b = specs["control-input-buses"][i]
             param = b[0]
             lab_name = factory.label(frame_control_in, "%d - %s" % (i+1, param))
             combo = factory.control_bus_combobox(frame_control_in, self.app)
             combo.set(b[1])
             lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4)
             combo.grid(row=row, column=1, sticky="w", padx=4, pady=4)
             self._combo_control_in[param] = combo
         except IndexError:
             lab_dummy = factory.label(frame_control_in, "%d - n/a" % (i+1, ))
             lab_dummy.grid(row=row, column=0)
         row += 1
     factory.padding_label(frame_control_in).grid(row=row, column=0)
     frame_control_in.grid(row=1, column=3, padx=4, pady=4, sticky='ew')
     # Control Output Buses
     frame_control_out = factory.label_frame(main, "Control Output Buses")
     row = 0
     for i in range(MAX_BUS_COUNT):
         try:
             b = specs["control-output-buses"][i]
             param = b[0]
             lab_name = factory.label(frame_control_out, "%d - %s" % (i+1, param))
             combo = factory.control_bus_combobox(frame_control_out, self.app)
             combo.set(b[1])
             lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4)
             combo.grid(row=row, column=1, sticky="w", padx=4, pady=4)
             self._combo_control_out[param] = combo
         except IndexError:
             lab_dummy = factory.label(frame_control_out, "%d - n/a" % (i+1, ))
             lab_dummy.grid(row=row, column=0)
         row += 1
     factory.padding_label(frame_control_out).grid(row=row, column=0)
     frame_control_out.grid(row=5, column=3, padx=4, pady=4, sticky='ew')
     # Buffers
     # if specs["buffers"]:
     #     frame_buffers = factory.label_frame(main, "Buffers")
     #     row = 0
     #     for param in specs["buffers"]:
     #         lab_name = factory.label(frame_buffers, param)
     #         combo = factory.buffer_combobox(frame_buffers, self.app)
     #         lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4)
     #         combo.grid(row=row, column=1, sticky="w", padx=4, pady=4)
     #         self._buffername_map[param] = combo
     #         row += 1
     #     factory.padding_label(frame_buffers).grid(row=row, column=0, sticky='ew')
     #     frame_buffers.grid(row=9, column=3, padx=4, pady=4)
     
     # Keymode
     self.var_keymode = StringVar()
     self.var_voice_count = StringVar()
     self.var_voice_count.set(8)
     frame_keymode = factory.label_frame(main, "Key mode")
     col = 0
     for km in specs["keymodes"]:
         rb = factory.radio(frame_keymode, km, self.var_keymode, km)
         rb.grid(row=0, column=col, sticky="w", padx=4, pady=4)
         col += 1
     self.var_keymode.set(specs["keymodes"][0])  # Set default keymode
     lab_vc = factory.label(frame_keymode, "Voice count")
     spin_vc = factory.int_spinbox(frame_keymode, self.var_voice_count, from_=1, to=128)
     lab_vc.grid(row=1, column=0, padx=4)
     spin_vc.grid(row=1, column=1, columnspan=3, padx=4, pady=4)
     frame_keymode.grid(row=9, column=0, padx=4, pady=4, sticky='ew')
     factory.padding_label(frame_keymode).grid(row=2, column=0)
     # South Toolbar
     toolbar = factory.frame(main)
     b_help = factory.help_button(toolbar, command=self.display_help)
     b_accept = factory.accept_button(toolbar, command=self.accept)
     b_cancel = factory.cancel_button(toolbar, command=self.cancel)
     b_help.grid(row=0, column=0, sticky="w")
     factory.padding_label(toolbar).grid(row=0, column=1)
     b_accept.grid(row=0, column=2, sticky="e")
     b_cancel.grid(row=0, column=3, sticky="e")
     toolbar.grid(row=10, column=0, columnspan=5, sticky="ew", padx=4, pady=8)
Esempio n. 14
0
 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
Esempio n. 15
0
 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)
Esempio n. 16
0
    def __init__(self,
                 master,
                 app,
                 synth_type,
                 is_efx=False,
                 is_controller=False):
        Toplevel.__init__(self, master)
        main = factory.frame(self)
        main.pack(anchor=W, expand=True, fill=BOTH)
        self.app = app
        self.stype = synth_type
        self.is_efx = is_efx
        self.is_controller = is_controller
        sid = "%s_%d" % (synth_type, SynthProxy.current_synth_serial_number())
        specs = SynthSpecs.global_synth_type_registry[synth_type]
        self._combo_audio_in = {}  # Maps synth parameter to combo box
        self._combo_audio_out = {}
        self._combo_control_in = {}
        self._combo_control_out = {}
        self._buffername_map = {}
        title = "Add %s " % synth_type
        if is_efx:
            title += "Effect"
        elif is_controller:
            title += "Controller Synth"
        else:
            title += "Synth"
        title += "      sid = %s" % sid
        frame_north = factory.frame(main)
        frame_north.grid(row=0,
                         column=0,
                         columnspan=2,
                         sticky='ew',
                         padx=4,
                         pady=8)
        logo_filename = os.path.join("resources", synth_type, "logo_small.png")
        lab_logo = factory.image_label(frame_north, logo_filename, synth_type)
        lab_id = factory.dialog_title_label(frame_north, title)
        lab_logo.grid(row=0, column=0, padx=8)
        lab_id.grid(row=0, column=1)
        # Audio Input Buses
        frame_audio_in = factory.label_frame(main, "Audio Input Buses")
        row = 0
        for i in range(MAX_BUS_COUNT):
            try:
                b = specs["audio-input-buses"][i]
                param = b[0]
                lab_name = factory.label(frame_audio_in,
                                         "%d - %s" % (i + 1, param))
                combo = factory.audio_bus_combobox(frame_audio_in, self.app)
                combo.set(b[1])
                lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4)
                combo.grid(row=row, column=1, sticky="w", padx=4, pady=4)
                self._combo_audio_in[param] = combo
            except IndexError:
                lab_dummy = factory.label(frame_audio_in,
                                          "%d - n/a" % (i + 1, ))
                lab_dummy.grid(row=row, column=0)
            row += 1
        factory.padding_label(frame_audio_in).grid(row=row, column=0)
        frame_audio_in.grid(row=1, column=0, padx=4, pady=4, sticky='ew')
        # Audio Output Buses
        frame_audio_out = factory.label_frame(main, "Audio Output Buses")
        row = 0
        for i in range(MAX_BUS_COUNT):
            try:
                b = specs["audio-output-buses"][i]
                param = b[0]
                lab_name = factory.label(frame_audio_out,
                                         "%d - %s" % (i + 1, param))
                combo = factory.audio_bus_combobox(frame_audio_out, self.app)
                combo.set(b[1])
                lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4)
                combo.grid(row=row, column=1, sticky="w", padx=4, pady=4)
                self._combo_audio_out[param] = combo
            except IndexError:
                lab_dummy = factory.label(frame_audio_out,
                                          "%d - n/a" % (i + 1, ))
                lab_dummy.grid(row=row, column=0)
            row += 1
        factory.padding_label(frame_audio_out).grid(row=row, column=0)
        frame_audio_out.grid(row=5, column=0, padx=4, pady=4, sticky='ew')
        # Control Input Buses
        frame_control_in = factory.label_frame(main, "Control Input Buses")
        row = 0
        for i in range(MAX_BUS_COUNT):
            try:
                b = specs["control-input-buses"][i]
                param = b[0]
                lab_name = factory.label(frame_control_in,
                                         "%d - %s" % (i + 1, param))
                combo = factory.control_bus_combobox(frame_control_in,
                                                     self.app)
                combo.set(b[1])
                lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4)
                combo.grid(row=row, column=1, sticky="w", padx=4, pady=4)
                self._combo_control_in[param] = combo
            except IndexError:
                lab_dummy = factory.label(frame_control_in,
                                          "%d - n/a" % (i + 1, ))
                lab_dummy.grid(row=row, column=0)
            row += 1
        factory.padding_label(frame_control_in).grid(row=row, column=0)
        frame_control_in.grid(row=1, column=3, padx=4, pady=4, sticky='ew')
        # Control Output Buses
        frame_control_out = factory.label_frame(main, "Control Output Buses")
        row = 0
        for i in range(MAX_BUS_COUNT):
            try:
                b = specs["control-output-buses"][i]
                param = b[0]
                lab_name = factory.label(frame_control_out,
                                         "%d - %s" % (i + 1, param))
                combo = factory.control_bus_combobox(frame_control_out,
                                                     self.app)
                combo.set(b[1])
                lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4)
                combo.grid(row=row, column=1, sticky="w", padx=4, pady=4)
                self._combo_control_out[param] = combo
            except IndexError:
                lab_dummy = factory.label(frame_control_out,
                                          "%d - n/a" % (i + 1, ))
                lab_dummy.grid(row=row, column=0)
            row += 1
        factory.padding_label(frame_control_out).grid(row=row, column=0)
        frame_control_out.grid(row=5, column=3, padx=4, pady=4, sticky='ew')
        # Buffers
        # if specs["buffers"]:
        #     frame_buffers = factory.label_frame(main, "Buffers")
        #     row = 0
        #     for param in specs["buffers"]:
        #         lab_name = factory.label(frame_buffers, param)
        #         combo = factory.buffer_combobox(frame_buffers, self.app)
        #         lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4)
        #         combo.grid(row=row, column=1, sticky="w", padx=4, pady=4)
        #         self._buffername_map[param] = combo
        #         row += 1
        #     factory.padding_label(frame_buffers).grid(row=row, column=0, sticky='ew')
        #     frame_buffers.grid(row=9, column=3, padx=4, pady=4)

        # Keymode
        self.var_keymode = StringVar()
        self.var_voice_count = StringVar()
        self.var_voice_count.set(8)
        frame_keymode = factory.label_frame(main, "Key mode")
        col = 0
        for km in specs["keymodes"]:
            rb = factory.radio(frame_keymode, km, self.var_keymode, km)
            rb.grid(row=0, column=col, sticky="w", padx=4, pady=4)
            col += 1
        self.var_keymode.set(specs["keymodes"][0])  # Set default keymode
        lab_vc = factory.label(frame_keymode, "Voice count")
        spin_vc = factory.int_spinbox(frame_keymode,
                                      self.var_voice_count,
                                      from_=1,
                                      to=128)
        lab_vc.grid(row=1, column=0, padx=4)
        spin_vc.grid(row=1, column=1, columnspan=3, padx=4, pady=4)
        frame_keymode.grid(row=9, column=0, padx=4, pady=4, sticky='ew')
        factory.padding_label(frame_keymode).grid(row=2, column=0)
        # South Toolbar
        toolbar = factory.frame(main)
        b_help = factory.help_button(toolbar, command=self.display_help)
        b_accept = factory.accept_button(toolbar, command=self.accept)
        b_cancel = factory.cancel_button(toolbar, command=self.cancel)
        b_help.grid(row=0, column=0, sticky="w")
        factory.padding_label(toolbar).grid(row=0, column=1)
        b_accept.grid(row=0, column=2, sticky="e")
        b_cancel.grid(row=0, column=3, sticky="e")
        toolbar.grid(row=10,
                     column=0,
                     columnspan=5,
                     sticky="ew",
                     padx=4,
                     pady=8)