Example #1
0
def normalize_dialog():
    def on_ok():
        f_window.f_result = f_db_spinbox.value()
        f_window.close()

    def on_cancel():
        f_window.close()

    f_window = QDialog(MAIN_WINDOW)
    f_window.f_result = None
    f_window.setWindowTitle(_("Normalize"))
    f_window.setFixedSize(150, 90)
    f_layout = QVBoxLayout()
    f_window.setLayout(f_layout)
    f_hlayout = QHBoxLayout()
    f_layout.addLayout(f_hlayout)
    f_hlayout.addWidget(QLabel("dB"))
    f_db_spinbox = QDoubleSpinBox()
    f_hlayout.addWidget(f_db_spinbox)
    f_db_spinbox.setRange(-18.0, 0.0)
    f_db_spinbox.setDecimals(1)
    f_db_spinbox.setValue(0.0)
    f_ok_button = QPushButton(_("OK"))
    f_ok_cancel_layout = QHBoxLayout()
    f_layout.addLayout(f_ok_cancel_layout)
    f_ok_cancel_layout.addWidget(f_ok_button)
    f_ok_button.pressed.connect(on_ok)
    f_cancel_button = QPushButton(_("Cancel"))
    f_ok_cancel_layout.addWidget(f_cancel_button)
    f_cancel_button.pressed.connect(on_cancel)
    f_window.exec_()
    return f_window.f_result
Example #2
0
    def __init__(self):
        QScrollArea.__init__(self)
        self.first_offline_render = True
        self.last_offline_dir = global_home
        self.copy_to_clipboard_checked = True

        self.setObjectName("plugin_ui")
        self.widget = QWidget()
        self.widget.setObjectName("plugin_ui")
        self.setWidget(self.widget)
        self.setWidgetResizable(True)
        self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
        self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)

        self.main_layout = QVBoxLayout()
        self.main_layout.setContentsMargins(2, 2, 2, 2)
        self.widget.setLayout(self.main_layout)

        #The tabs
        self.main_tabwidget = QTabWidget()
        self.main_layout.addWidget(self.main_tabwidget)

        self.main_tabwidget.addTab(WAVE_EDITOR.widget, _("Wave Editor"))

        self.notes_tab = QTextEdit(self)
        self.notes_tab.setAcceptRichText(False)
        self.notes_tab.leaveEvent = self.on_edit_notes
        self.main_tabwidget.addTab(self.notes_tab, _("Project Notes"))
        self.main_tabwidget.currentChanged.connect(self.tab_changed)
Example #3
0
    def __init__(self, a_num, a_layout, a_callback, a_count):
        self.input_num = int(a_num)
        self.callback = a_callback
        a_layout.addWidget(QLabel(str(a_num)), a_num + 1, 21)
        self.name_lineedit = QLineEdit(str(a_num))
        self.name_lineedit.editingFinished.connect(self.name_update)
        a_num += 1
        a_layout.addWidget(self.name_lineedit, a_num, 0)
        self.rec_checkbox = QCheckBox("")
        self.rec_checkbox.clicked.connect(self.update_engine)
        a_layout.addWidget(self.rec_checkbox, a_num, 1)

        self.monitor_checkbox = QCheckBox(_(""))
        self.monitor_checkbox.clicked.connect(self.update_engine)
        a_layout.addWidget(self.monitor_checkbox, a_num, 2)

        self.vol_layout = QHBoxLayout()
        a_layout.addLayout(self.vol_layout, a_num, 3)
        self.vol_slider = QSlider(QtCore.Qt.Horizontal)
        self.vol_slider.setRange(-240, 240)
        self.vol_slider.setValue(0)
        self.vol_slider.setMinimumWidth(240)
        self.vol_slider.valueChanged.connect(self.vol_changed)
        self.vol_slider.sliderReleased.connect(self.update_engine)
        self.vol_layout.addWidget(self.vol_slider)
        self.vol_label = QLabel("0.0dB")
        self.vol_label.setMinimumWidth(64)
        self.vol_layout.addWidget(self.vol_label)
        self.stereo_combobox = QComboBox()
        a_layout.addWidget(self.stereo_combobox, a_num, 4)
        self.stereo_combobox.setMinimumWidth(72)
        self.stereo_combobox.addItems([_("None")] +
                                      [str(x) for x in range(a_count + 1)])
        self.stereo_combobox.currentIndexChanged.connect(self.update_engine)
        self.suppress_updates = False
Example #4
0
    def __init__(self):
        self.widget = QWidget(libmk.MAIN_WINDOW)
        self.vlayout = QVBoxLayout(self.widget)
        self.menu_layout = QHBoxLayout()
        self.vlayout.addLayout(self.menu_layout)
        self.track_combobox = QComboBox()
        self.track_combobox.setMinimumWidth(300)
        self.menu_layout.addWidget(QLabel(_("Track")))
        self.menu_layout.addWidget(self.track_combobox)

        self.plugins_button = QPushButton(_("Menu"))
        self.plugins_menu = QMenu(self.widget)
        self.plugins_button.setMenu(self.plugins_menu)
        self.plugins_order_action = self.plugins_menu.addAction(_("Order..."))
        self.plugins_order_action.triggered.connect(self.set_plugin_order)
        self.menu_layout.addItem(QSpacerItem(20, 1))
        self.menu_layout.addWidget(self.plugins_button)

        self.menu_layout.addItem(QSpacerItem(1, 1, QSizePolicy.Expanding))

        self.stacked_widget = QStackedWidget()
        self.vlayout.addWidget(self.stacked_widget)
        self.enabled = True
        self.plugin_racks = {}
        self.last_rack_num = None
Example #5
0
def normalize_dialog():
    def on_ok():
        f_window.f_result = f_db_spinbox.value()
        f_window.close()

    def on_cancel():
        f_window.close()

    f_window = QDialog(MAIN_WINDOW)
    f_window.f_result = None
    f_window.setWindowTitle(_("Normalize"))
    f_window.setFixedSize(150, 90)
    f_layout = QVBoxLayout()
    f_window.setLayout(f_layout)
    f_hlayout = QHBoxLayout()
    f_layout.addLayout(f_hlayout)
    f_hlayout.addWidget(QLabel("dB"))
    f_db_spinbox = QDoubleSpinBox()
    f_hlayout.addWidget(f_db_spinbox)
    f_db_spinbox.setRange(-18.0, 0.0)
    f_db_spinbox.setDecimals(1)
    f_db_spinbox.setValue(0.0)
    f_ok_button = QPushButton(_("OK"))
    f_ok_cancel_layout = QHBoxLayout()
    f_layout.addLayout(f_ok_cancel_layout)
    f_ok_cancel_layout.addWidget(f_ok_button)
    f_ok_button.pressed.connect(on_ok)
    f_cancel_button = QPushButton(_("Cancel"))
    f_ok_cancel_layout.addWidget(f_cancel_button)
    f_cancel_button.pressed.connect(on_cancel)
    f_window.exec_()
    return f_window.f_result
Example #6
0
    def __init__(self, a_num, a_layout, a_callback, a_count):
        self.input_num = int(a_num)
        self.callback = a_callback
        a_layout.addWidget(QLabel(str(a_num)), a_num + 1, 21)
        self.name_lineedit = QLineEdit(str(a_num))
        self.name_lineedit.editingFinished.connect(self.name_update)
        a_num += 1
        a_layout.addWidget(self.name_lineedit, a_num, 0)
        self.rec_checkbox = QCheckBox("")
        self.rec_checkbox.clicked.connect(self.update_engine)
        a_layout.addWidget(self.rec_checkbox, a_num, 1)

        self.monitor_checkbox = QCheckBox(_(""))
        self.monitor_checkbox.clicked.connect(self.update_engine)
        a_layout.addWidget(self.monitor_checkbox, a_num, 2)

        self.vol_layout = QHBoxLayout()
        a_layout.addLayout(self.vol_layout, a_num, 3)
        self.vol_slider = QSlider(QtCore.Qt.Horizontal)
        self.vol_slider.setRange(-240, 240)
        self.vol_slider.setValue(0)
        self.vol_slider.setMinimumWidth(240)
        self.vol_slider.valueChanged.connect(self.vol_changed)
        self.vol_slider.sliderReleased.connect(self.update_engine)
        self.vol_layout.addWidget(self.vol_slider)
        self.vol_label = QLabel("0.0dB")
        self.vol_label.setMinimumWidth(64)
        self.vol_layout.addWidget(self.vol_label)
        self.stereo_combobox = QComboBox()
        a_layout.addWidget(self.stereo_combobox, a_num, 4)
        self.stereo_combobox.setMinimumWidth(72)
        self.stereo_combobox.addItems([_("None")] +
            [str(x) for x in range(a_count + 1)])
        self.stereo_combobox.currentIndexChanged.connect(self.update_engine)
        self.suppress_updates = False
Example #7
0
 def open_file(self, a_file):
     f_file = str(a_file)
     if not os.path.exists(f_file):
         QMessageBox.warning(self.widget, _("Error"),
                             _("{} does not exist".format(f_file)))
         return
     self.file_name = f_file
     libmk.APP.setOverrideCursor(QtCore.Qt.WaitCursor)
     self.clear_sample_graph()
     self.current_file = f_file
     self.file_lineedit.setText(f_file)
     self.set_sample_graph(f_file)
     self.duration = float(self.graph_object.frame_count) / float(
         self.graph_object.sample_rate)
     if f_file in self.history:
         self.history.remove(f_file)
     self.history.append(f_file)
     f_menu = QMenu(self.history_button)
     f_menu.triggered.connect(self.open_file_from_action)
     for f_path in reversed(self.history):
         f_action = f_menu.addAction(f_path)
         f_action.file_name = f_path
     self.history_button.setMenu(f_menu)
     PROJECT.IPC.pydaw_ab_open(libmk.PROJECT.get_wav_uid_by_name(a_file))
     self.marker_callback()
     libmk.APP.restoreOverrideCursor()
     self.vol_slider.setEnabled(True)
Example #8
0
 def open_file(self, a_file):
     f_file = str(a_file)
     if not os.path.exists(f_file):
         QMessageBox.warning(
             self.widget, _("Error"),
             _("{} does not exist".format(f_file)))
         return
     libmk.APP.setOverrideCursor(QtCore.Qt.WaitCursor)
     self.clear_sample_graph()
     self.current_file = f_file
     self.file_lineedit.setText(f_file)
     self.set_sample_graph(f_file)
     self.duration = float(self.graph_object.frame_count) / float(
         self.graph_object.sample_rate)
     if f_file in self.history:
         self.history.remove(f_file)
     self.history.append(f_file)
     f_menu = QMenu(self.history_button)
     f_menu.triggered.connect(self.open_file_from_action)
     for f_path in reversed(self.history):
         f_action = f_menu.addAction(f_path)
         f_action.file_name = f_path
     self.history_button.setMenu(f_menu)
     PROJECT.wn_osc.pydaw_ab_open(a_file)
     self.marker_callback()
     libmk.APP.restoreOverrideCursor()
Example #9
0
    def __init__(self):
        self.widget = QWidget(libmk.MAIN_WINDOW)
        self.vlayout = QVBoxLayout(self.widget)
        self.menu_layout = QHBoxLayout()
        self.vlayout.addLayout(self.menu_layout)
        self.track_combobox = QComboBox()
        self.track_combobox.setMinimumWidth(300)
        self.menu_layout.addWidget(QLabel(_("Track")))
        self.menu_layout.addWidget(self.track_combobox)

        self.plugins_button = QPushButton(_("Menu"))
        self.plugins_menu = QMenu(self.widget)
        self.plugins_button.setMenu(self.plugins_menu)
        self.plugins_order_action = self.plugins_menu.addAction(_("Order..."))
        self.plugins_order_action.triggered.connect(self.set_plugin_order)
        self.menu_layout.addItem(QSpacerItem(20, 1))
        self.menu_layout.addWidget(self.plugins_button)

        self.menu_layout.addItem(QSpacerItem(1, 1, QSizePolicy.Expanding))

        self.stacked_widget = QStackedWidget()
        self.vlayout.addWidget(self.stacked_widget)
        self.enabled = True
        self.plugin_racks = {}
        self.last_rack_num = None
Example #10
0
    def __init__(self):
        QScrollArea.__init__(self)
        self.first_offline_render = True
        self.last_offline_dir = global_home
        self.copy_to_clipboard_checked = True

        self.setObjectName("plugin_ui")
        self.widget = QWidget()
        self.widget.setObjectName("plugin_ui")
        self.setWidget(self.widget)
        self.setWidgetResizable(True)
        self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
        self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)

        self.main_layout = QVBoxLayout()
        self.main_layout.setContentsMargins(2, 2, 2, 2)
        self.widget.setLayout(self.main_layout)

        #The tabs
        self.main_tabwidget = QTabWidget()
        self.main_layout.addWidget(self.main_tabwidget)

        self.main_tabwidget.addTab(WAVE_EDITOR.widget, _("Wave Editor"))

        self.notes_tab = QTextEdit(self)
        self.notes_tab.setAcceptRichText(False)
        self.notes_tab.leaveEvent = self.on_edit_notes
        self.main_tabwidget.addTab(self.notes_tab, _("Project Notes"))
Example #11
0
        def on_ok(a_self=None):
            f_buffer_size = int(str(f_buffer_size_combobox.currentText()))
            f_samplerate = int(str(f_samplerate_combobox.currentText()))
            f_worker_threads = f_worker_threads_combobox.currentIndex()
            f_midi_in_device = str(f_midi_in_device_combobox.currentText())
            f_audio_engine = f_audio_engine_combobox.currentIndex()
            if f_thread_affinity_checkbox.isChecked():
                f_thread_affinity = 1
            else:
                f_thread_affinity = 0
            if f_governor_checkbox.isChecked():
                f_performance = 1
            else:
                f_performance = 0
            try:
                #This doesn't work if the device is open already,
                #so skip the test, and if it fails the
                #user will be prompted again next time PyDAW starts
                if f_audio_engine != 7 or \
                not self.is_running or \
                "name" not in pydaw_util.global_device_val_dict or \
                pydaw_util.global_device_val_dict["name"] != self.device_name:
                    f_output = portaudio.PaStreamParameters(
                        f_name_to_index[self.device_name],
                        2, portaudio.paInt16,
                        float(f_buffer_size)/float(f_samplerate), None)
                    f_supported = self.pyaudio.Pa_IsFormatSupported(
                        0, ctypes.byref(f_output), f_samplerate)
                    if not f_supported:
                        raise Exception()
                f_file = open(pydaw_util.global_pydaw_device_config, "w")
                f_file.write("name|{}\n".format(self.device_name))
                f_file.write("bufferSize|{}\n".format(f_buffer_size))
                f_file.write("sampleRate|{}\n".format(f_samplerate))
                f_file.write("audioEngine|{}\n".format(f_audio_engine))
                f_file.write("threads|{}\n".format(f_worker_threads))
                f_file.write("threadAffinity|{}\n".format(f_thread_affinity))
                f_file.write("performance|{}\n".format(f_performance))
                f_file.write("midiInDevice|{}\n".format(f_midi_in_device))

                f_file.write("\\")
                f_file.close()
                self.close_devices()

                if a_notify:
                    QtGui.QMessageBox.warning(f_window, _("Settings changed"),
                      _("Hardware settings have been changed, and will be "
                      "applied next time you start PyDAW."))
                time.sleep(1.0)
                pydaw_util.pydaw_read_device_config()
                self.dialog_result = True
                f_window.close()

            except Exception as ex:
                QtGui.QMessageBox.warning(f_window, _("Error"),
                    _("Couldn't open audio device\n\n{}\n\n"
                    "This may (or may not) be because the "
                    "device already open by "
                    "another application such as a DAW, or Jack.").format(ex))
Example #12
0
 def open_file_from_clipboard(self):
     if libmk.IS_PLAYING:
         return
     f_clipboard = QApplication.clipboard()
     f_text = str(f_clipboard.text()).strip()
     if len(f_text) < 1000 and os.path.isfile(f_text):
         self.open_file(f_text)
     else:
         QMessageBox.warning(self.widget, _("Error"),
                             _("No file path in the clipboard"))
Example #13
0
    def check_device(self):
        if not pydaw_util.global_device_val_dict:
            self.show_device_dialog(
                _("No device configuration found"), a_exit_on_cancel=True)
            return
        elif not "name" in pydaw_util.global_device_val_dict:
            self.show_device_dialog(
                _("Invalid device configuration"), a_exit_on_cancel=True)
            return

        f_device_str = pydaw_util.global_device_val_dict["name"]

        self.open_devices()

        f_count = self.pyaudio.Pa_GetDeviceCount()

        f_audio_device_names = []

        for i in range(f_count):
            f_dev = self.pyaudio.Pa_GetDeviceInfo(i)
            f_dev_name = f_dev.contents.name.decode("utf-8")
            f_audio_device_names.append(f_dev_name)

        self.close_devices()

        if not f_device_str in f_audio_device_names:
            print("{} not in {}".format(f_device_str, f_audio_device_names))
            pydaw_util.global_device_val_dict.pop("name")
            if "(hw:" in f_device_str:
                f_device_arr = f_device_str.split("(hw:")
                f_device_name = f_device_arr[0]
                f_device_num = f_device_arr[1].split(",", 1)[1]
                for f_device in f_audio_device_names:
                    if f_device.startswith(f_device_name) and \
                    f_device.endswith(f_device_num):
                        print(
                            _("It appears that the system switched up the "
                            "ALSA hw:X number, fixing it all sneaky-like "
                            "in the background.  (grumble, grumble...)"))
                        print(f_device)
                        pydaw_util.global_device_val_dict["name"] = f_device
                        f_file = open(
                            pydaw_util.global_pydaw_device_config, "w")
                        for k, v in pydaw_util.global_device_val_dict.items():
                            f_file.write("{}|{}\n".format(k, v))
                        f_file.write("\\")
                        f_file.close()
                        return
                self.show_device_dialog(
                    _("Device not found: {}").format(f_device_str),
                    a_exit_on_cancel=True)
            else:
                self.show_device_dialog(
                    _("Device not found: {}").format(f_device_str),
                    a_exit_on_cancel=True)
Example #14
0
 def open_file_from_clipboard(self):
     if libmk.IS_PLAYING:
         return
     f_clipboard = QApplication.clipboard()
     f_text = str(f_clipboard.text()).strip()
     if len(f_text) < 1000 and os.path.isfile(f_text):
         self.open_file(f_text)
     else:
         QMessageBox.warning(
             self.widget, _("Error"),
             _("No file path in the clipboard"))
Example #15
0
    def __init__(self, *args, **kwargs):
        pydaw_abstract_plugin_ui.__init__(self, *args, **kwargs)
        self._plugin_name = "MKCHNL"
        self.is_instrument = False
        f_knob_size = 42
        self.gain_gridlayout = QGridLayout()
        if self.is_mixer:
            self.layout.addLayout(self.gain_gridlayout)
        else:
            self.hlayout = QHBoxLayout()
            self.layout.addLayout(self.hlayout)
            self.hlayout.addLayout(self.gain_gridlayout)
        self.gain_knob = pydaw_knob_control(f_knob_size, _("Gain"),
                                            MKCHNL_GAIN,
                                            self.plugin_rel_callback,
                                            self.plugin_val_callback, -2400,
                                            2400, 0, KC_DECIMAL,
                                            self.port_dict, None)
        self.gain_knob.add_to_grid_layout(self.gain_gridlayout, 0)
        self.gain_knob.value_label.setMinimumWidth(55)

        self.pan_knob = pydaw_knob_control(f_knob_size, _("Pan"), MKCHNL_PAN,
                                           self.plugin_rel_callback,
                                           self.plugin_val_callback, -100, 100,
                                           0, KC_DECIMAL, self.port_dict, None)
        self.pan_knob.add_to_grid_layout(self.gain_gridlayout, 1)
        self.pan_law_knob = pydaw_knob_control(f_knob_size, _("Law"),
                                               MKCHNL_LAW,
                                               self.plugin_rel_callback,
                                               self.plugin_val_callback, -600,
                                               0, -300, KC_DECIMAL,
                                               self.port_dict, None)
        self.pan_law_knob.add_to_grid_layout(self.gain_gridlayout, 2)

        self.volume_gridlayout = QGridLayout()
        self.layout.addLayout(self.volume_gridlayout)
        self.volume_slider = pydaw_slider_control(
            QtCore.Qt.Vertical if self.is_mixer else QtCore.Qt.Horizontal,
            "Vol", MKCHNL_VOL_SLIDER, self.plugin_rel_callback,
            self.plugin_val_callback, -5000, 0, 0, KC_DECIMAL, self.port_dict)
        if self.is_mixer:
            self.volume_slider.add_to_grid_layout(self.volume_gridlayout, 0)
            self.volume_slider.control.setSizePolicy(QSizePolicy.Minimum,
                                                     QSizePolicy.Expanding)
        else:
            self.volume_slider_layout = QGridLayout()
            self.volume_slider_layout.setSizeConstraint(QLayout.SetMaximumSize)
            self.hlayout.addLayout(self.volume_slider_layout, 1)
            self.volume_slider.add_to_grid_layout(self.volume_slider_layout,
                                                  0,
                                                  a_alignment=None)
        self.volume_slider.value_label.setMinimumWidth(180)
        self.open_plugin_file()
        self.set_midi_learn(MKCHNL_PORT_MAP)
Example #16
0
 def on_rec(self):
     if not self.audio_inputs.active():
         QMessageBox.warning(
             self.group_box, _("Error"),
             _("No audio inputs are active, cannot record.  "
             "Enable one or more inputs in the transport drop-down.\n"
             "If there are no inputs in the drop-down, you will need "
             "to open the Menu->File->HardwareSettings in the \n"
             "transport and set the number of audio inputs to 1 or more"))
         return False
     PROJECT.wn_osc.pydaw_wn_playback(2)
     self.playback_menu_button.setEnabled(False)
     return True
Example #17
0
 def on_rec(self):
     if not self.audio_inputs.active():
         QMessageBox.warning(
             self.group_box, _("Error"),
             _("No audio inputs are active, cannot record.  "
               "Enable one or more inputs in the transport drop-down.\n"
               "If there are no inputs in the drop-down, you will need "
               "to open the Menu->File->HardwareSettings in the \n"
               "transport and set the number of audio inputs to 1 or more"))
         return False
     PROJECT.IPC.pydaw_wn_playback(2)
     self.playback_menu_button.setEnabled(False)
     return True
Example #18
0
    def __init__(self, *args, **kwargs):
        pydaw_abstract_plugin_ui.__init__(self, *args, **kwargs)
        self._plugin_name = "MK Limiter"
        self.is_instrument = False

        self.preset_manager = None
        self.layout.setSizeConstraint(QLayout.SetFixedSize)

        self.delay_hlayout = QHBoxLayout()
        self.layout.addLayout(self.delay_hlayout)

        f_knob_size = DEFAULT_KNOB_SIZE

        self.groupbox_gridlayout = QGridLayout()
        self.delay_hlayout.addLayout(self.groupbox_gridlayout)

        self.thresh_knob = pydaw_knob_control(f_knob_size, _("Thresh"),
                                              MK_LIM_THRESHOLD,
                                              self.plugin_rel_callback,
                                              self.plugin_val_callback, -360,
                                              0, 0, KC_TENTH, self.port_dict,
                                              self.preset_manager)
        self.thresh_knob.add_to_grid_layout(self.groupbox_gridlayout, 3)

        self.ceiling_knob = pydaw_knob_control(f_knob_size, _("Ceiling"),
                                               MK_LIM_CEILING,
                                               self.plugin_rel_callback,
                                               self.plugin_val_callback, -180,
                                               0, 0, KC_TENTH, self.port_dict,
                                               self.preset_manager)
        self.ceiling_knob.add_to_grid_layout(self.groupbox_gridlayout, 7)

        self.release_knob = pydaw_knob_control(
            f_knob_size, _("Release"), MK_LIM_RELEASE,
            self.plugin_rel_callback, self.plugin_val_callback, 50, 1500, 500,
            KC_INTEGER, self.port_dict, self.preset_manager)
        self.release_knob.add_to_grid_layout(self.groupbox_gridlayout, 22)

        self.peak_meter = peak_meter(16, False)
        self.delay_hlayout.addWidget(self.peak_meter.widget)

        self.ui_msg_enabled = pydaw_null_control(MK_LIM_UI_MSG_ENABLED,
                                                 self.plugin_rel_callback,
                                                 self.plugin_val_callback, 0,
                                                 self.port_dict)

        self.open_plugin_file()
        self.set_midi_learn(MK_LIM_PORT_MAP)
        self.enable_ui_msg(True)
Example #19
0
 def set_tooltips(self, a_on):
     if a_on:
         self.sample_graph.setToolTip(
             _("Load samples here by using the browser on the left "
               "and clicking the  'Load' button"))
         self.menu_button.setToolTip(
             _("This menu can export the audio or perform "
               "various operations."))
         self.history_button.setToolTip(
             _("Use this button to view or open files that "
               "were previously opened during this session."))
     else:
         self.sample_graph.setToolTip("")
         self.menu_button.setToolTip("")
         self.history_button.setToolTip("")
Example #20
0
def project_recover_dialog(a_file):
    f_window = QMainWindow()
    f_window.setStyleSheet(pydaw_util.global_stylesheet)
    f_window.setWindowState(QtCore.Qt.WindowMaximized)
    f_window.setWindowTitle("Project History")
    if a_file is None:
        f_file, f_filter = QFileDialog.getOpenFileName(
            caption='Open Project',
            filter=pydaw_util.global_pydaw_file_type_string,
            directory=pydaw_util.global_default_project_folder)
        if f_file is None or not str(f_file):
            return None
    else:
        f_file = a_file
    f_project_dir = os.path.dirname(str(f_file))
    f_backup_file = os.path.join(f_project_dir, "backups.json")
    if not os.path.isfile(f_backup_file):
        f_answer = QMessageBox.question(
            f_window, _("Error"), _("No backups exist for this "
            "project, recovery is not possible.\nPress 'Yes' to "
            "open another project,\n'No' to create a new project,\n"
            "or 'Cancel' to close MusiKernel"),
            QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel,
            QMessageBox.Cancel)
        if (f_answer == QMessageBox.Yes and pydaw_util.open_project()) or \
        (f_answer == QMessageBox.No and pydaw_util.new_project()):
            pydaw_util.run_musikernel()
            exit(0)
        exit(1)
    f_backup_dir = os.path.join(f_project_dir, "backups")
    f_central_widget = QWidget()
    f_layout = QVBoxLayout(f_central_widget)
    f_window.setCentralWidget(f_central_widget)
    f_widget = project_history_widget(
        f_backup_dir, f_backup_file, f_project_dir)
    f_layout.addWidget(f_widget)
    f_hlayout = QHBoxLayout()
    f_layout.addLayout(f_hlayout)
    f_set_project_button = QPushButton(
        _("Revert Project to Selected"))
    f_set_project_button.pressed.connect(
        f_widget.set_selected_as_project)
    f_hlayout.addWidget(f_set_project_button)
    f_hlayout.addItem(
        QSpacerItem(1, 1, QSizePolicy.Expanding))
    print("showing")
    f_window.show()
    return f_window
Example #21
0
    def __init__(self, *args, **kwargs):
        pydaw_abstract_plugin_ui.__init__(self, *args, **kwargs)
        self._plugin_name = "XFADE"
        self.is_instrument = False
        self.layout.setSizeConstraint(QLayout.SetFixedSize)
        f_knob_size = DEFAULT_KNOB_SIZE

        self.hlayout = QHBoxLayout()
        self.layout.addLayout(self.hlayout)

        self.volume_gridlayout = QGridLayout()
        self.hlayout.addLayout(self.volume_gridlayout)
        self.volume_slider = pydaw_slider_control(QtCore.Qt.Horizontal,
                                                  "X-Fade", XFADE_SLIDER,
                                                  self.plugin_rel_callback,
                                                  self.plugin_val_callback,
                                                  -100, 100, 0, KC_DECIMAL,
                                                  self.port_dict)
        self.volume_slider.add_to_grid_layout(self.volume_gridlayout, 0)
        self.volume_slider.control.setMinimumWidth(300)
        self.volume_slider.value_label.setMinimumWidth(60)
        self.midpoint_knob = pydaw_knob_control(f_knob_size, _("Mid-Point"),
                                                XFADE_MIDPOINT,
                                                self.plugin_rel_callback,
                                                self.plugin_val_callback, -600,
                                                0, -300, KC_DECIMAL,
                                                self.port_dict, None)
        self.midpoint_knob.add_to_grid_layout(self.volume_gridlayout, 1)
        self.midpoint_knob.value_label.setMinimumWidth(60)

        self.hlayout.addWidget(QLabel(XFADE_TOOLTIP))

        self.open_plugin_file()
        self.set_midi_learn(XFADE_PORT_MAP)
Example #22
0
    def __init__(self, a_val_callback, a_project,
                 a_folder, a_plugin_uid, a_track_name, a_stylesheet,
                 a_configure_callback, a_midi_learn_callback,
                 a_cc_map_callback):
        pydaw_abstract_plugin_ui.__init__(
            self, a_val_callback, a_project, a_plugin_uid, a_stylesheet,
            a_configure_callback, a_folder, a_midi_learn_callback,
            a_cc_map_callback)
        self._plugin_name = "XFADE"
        self.set_window_title(a_track_name)
        self.is_instrument = False
        #self.layout.setSizeConstraint(QLayout.SetFixedSize)
        f_knob_size = 48
        self.widget.setToolTip(XFADE_TOOLTIP)

        self.volume_gridlayout = QGridLayout()
        self.layout.addLayout(self.volume_gridlayout)
        self.volume_slider = pydaw_slider_control(
            QtCore.Qt.Horizontal, "X-Fade", XFADE_SLIDER,
            self.plugin_rel_callback, self.plugin_val_callback,
            -100, 100, 0, KC_DECIMAL, self.port_dict)
        self.volume_slider.add_to_grid_layout(self.volume_gridlayout, 0)
        self.volume_slider.control.setMinimumWidth(300)
        self.volume_slider.value_label.setMinimumWidth(60)
        self.scrollarea_widget.setFixedHeight(120)
        self.scrollarea_widget.setFixedWidth(375)
        self.midpoint_knob = pydaw_knob_control(
            f_knob_size, _("Mid-Point"), XFADE_MIDPOINT,
            self.plugin_rel_callback, self.plugin_val_callback,
            -600, 0, -300, KC_DECIMAL, self.port_dict, None)
        self.midpoint_knob.add_to_grid_layout(self.volume_gridlayout, 1)
        self.midpoint_knob.value_label.setMinimumWidth(60)

        self.open_plugin_file()
        self.set_midi_learn(XFADE_PORT_MAP)
Example #23
0
    def __init__(self, a_val_callback, a_project,
                 a_folder, a_plugin_uid, a_track_name, a_stylesheet,
                 a_configure_callback, a_midi_learn_callback,
                 a_cc_map_callback):
        pydaw_abstract_plugin_ui.__init__(
            self, a_val_callback, a_project, a_plugin_uid, a_stylesheet,
            a_configure_callback, a_folder, a_midi_learn_callback,
            a_cc_map_callback)
        self._plugin_name = "MKCHNL"
        self.set_window_title(a_track_name)
        self.is_instrument = False
        #self.layout.setSizeConstraint(QLayout.SetFixedSize)
        f_knob_size = 32
        self.gain_gridlayout = QGridLayout()
        self.layout.addLayout(self.gain_gridlayout)
        self.gain_knob = pydaw_knob_control(
            f_knob_size, _("Gain"), MKCHNL_GAIN,
            self.plugin_rel_callback, self.plugin_val_callback,
            -2400, 2400, 0, KC_DECIMAL, self.port_dict, None)
        self.gain_knob.add_to_grid_layout(self.gain_gridlayout, 0)

        self.pan_knob = pydaw_knob_control(
            f_knob_size, _("Pan"), MKCHNL_PAN,
            self.plugin_rel_callback, self.plugin_val_callback,
            -100, 100, 0, KC_DECIMAL, self.port_dict, None)
        self.pan_knob.add_to_grid_layout(self.gain_gridlayout, 1)
        self.pan_law_knob = pydaw_knob_control(
            f_knob_size, _("Law"), MKCHNL_LAW,
            self.plugin_rel_callback, self.plugin_val_callback,
            -600, 0, -300, KC_DECIMAL, self.port_dict, None)
        self.pan_law_knob.add_to_grid_layout(self.gain_gridlayout, 2)

        self.volume_gridlayout = QGridLayout()
        self.layout.addLayout(self.volume_gridlayout)
        self.volume_slider = pydaw_slider_control(
            QtCore.Qt.Vertical, "Vol", MKCHNL_VOL_SLIDER,
            self.plugin_rel_callback, self.plugin_val_callback,
            -5000, 0, 0, KC_DECIMAL, self.port_dict)
        self.volume_slider.add_to_grid_layout(self.volume_gridlayout, 0)
        self.volume_slider.control.setMinimumHeight(240)
        self.volume_slider.control.setSizePolicy(
            QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.widget.setFixedWidth(130)
        self.volume_slider.value_label.setMinimumWidth(91)
        self.widget.setWidgetResizable(True)
        self.open_plugin_file()
        self.set_midi_learn(MKCHNL_PORT_MAP)
Example #24
0
def project_recover_dialog(a_file):
    f_window = QMainWindow()
    f_window.setStyleSheet(pydaw_util.STYLESHEET)
    f_window.setWindowState(QtCore.Qt.WindowMaximized)
    f_window.setWindowTitle("Project History")
    if a_file is None:
        f_file, f_filter = QFileDialog.getOpenFileName(
            caption='Open Project',
            filter=pydaw_util.global_pydaw_file_type_string,
            directory=pydaw_util.global_default_project_folder)
        if f_file is None or not str(f_file):
            return None
    else:
        f_file = a_file
    f_project_dir = os.path.dirname(str(f_file))
    f_backup_file = os.path.join(f_project_dir, "backups.json")
    if not os.path.isfile(f_backup_file):
        f_answer = QMessageBox.question(
            f_window, _("Error"),
            _("No backups exist for this "
              "project, recovery is not possible.\nPress 'Yes' to "
              "open another project,\n'No' to create a new project,\n"
              "or 'Cancel' to close MusiKernel"),
            QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel,
            QMessageBox.Cancel)
        if (f_answer == QMessageBox.Yes and pydaw_util.open_project()) or \
        (f_answer == QMessageBox.No and pydaw_util.new_project()):
            pydaw_util.run_musikernel()
            exit(0)
        exit(1)
    f_backup_dir = os.path.join(f_project_dir, "backups")
    f_central_widget = QWidget()
    f_layout = QVBoxLayout(f_central_widget)
    f_window.setCentralWidget(f_central_widget)
    f_widget = project_history_widget(f_backup_dir, f_backup_file,
                                      f_project_dir)
    f_layout.addWidget(f_widget)
    f_hlayout = QHBoxLayout()
    f_layout.addLayout(f_hlayout)
    f_set_project_button = QPushButton(_("Revert Project to Selected"))
    f_set_project_button.pressed.connect(f_widget.set_selected_as_project)
    f_hlayout.addWidget(f_set_project_button)
    f_hlayout.addItem(QSpacerItem(1, 1, QSizePolicy.Expanding))
    print("showing")
    f_window.show()
    return f_window
Example #25
0
    def __init__(self, *args, **kwargs):
        pydaw_abstract_plugin_ui.__init__(self, *args, **kwargs)
        self._plugin_name = "MK Limiter"
        self.is_instrument = False

        self.preset_manager = None
        self.layout.setSizeConstraint(QLayout.SetFixedSize)

        self.delay_hlayout = QHBoxLayout()
        self.layout.addLayout(self.delay_hlayout)

        f_knob_size = DEFAULT_KNOB_SIZE

        self.groupbox_gridlayout = QGridLayout()
        self.delay_hlayout.addLayout(self.groupbox_gridlayout)

        self.thresh_knob = pydaw_knob_control(
            f_knob_size, _("Thresh"), MK_LIM_THRESHOLD,
            self.plugin_rel_callback, self.plugin_val_callback,
            -360, 0, 0, KC_TENTH, self.port_dict, self.preset_manager)
        self.thresh_knob.add_to_grid_layout(self.groupbox_gridlayout, 3)

        self.ceiling_knob = pydaw_knob_control(
            f_knob_size, _("Ceiling"), MK_LIM_CEILING,
            self.plugin_rel_callback, self.plugin_val_callback,
            -180, 0, 0, KC_TENTH, self.port_dict, self.preset_manager)
        self.ceiling_knob.add_to_grid_layout(self.groupbox_gridlayout, 7)

        self.release_knob = pydaw_knob_control(
            f_knob_size, _("Release"), MK_LIM_RELEASE,
            self.plugin_rel_callback, self.plugin_val_callback,
            50, 1500, 500, KC_INTEGER, self.port_dict, self.preset_manager)
        self.release_knob.add_to_grid_layout(self.groupbox_gridlayout, 22)

        self.peak_meter = peak_meter(16, False)
        self.delay_hlayout.addWidget(self.peak_meter.widget)

        self.ui_msg_enabled = pydaw_null_control(
            MK_LIM_UI_MSG_ENABLED,
            self.plugin_rel_callback, self.plugin_val_callback,
            0, self.port_dict)

        self.open_plugin_file()
        self.set_midi_learn(MK_LIM_PORT_MAP)
        self.enable_ui_msg(True)
Example #26
0
 def __init__(self, a_callback):
     self.callback = a_callback
     QPushButton.__init__(self, _("None"))
     self.setObjectName("plugin_menu")
     self.menu = QMenu()
     self.setMenu(self.menu)
     f_action = self.menu.addAction("None")
     f_action.plugin_name = "None"
     self._index = 0
     self.menu.triggered.connect(self.action_triggered)
Example #27
0
 def __init__(self, a_callback):
     self.callback = a_callback
     QPushButton.__init__(self, _("None"))
     self.setObjectName("plugin_menu")
     self.menu = QMenu()
     self.setMenu(self.menu)
     f_action = self.menu.addAction("None")
     f_action.plugin_name = "None"
     self._index = 0
     self.menu.triggered.connect(self.action_triggered)
Example #28
0
 def set_tooltips(self, a_on):
     if a_on:
         self.sample_graph.setToolTip(
             _("Load samples here by using the browser on the left "
             "and clicking the  'Load' button"))
         self.fx_button.setToolTip(
             _("This button shows the Modulex effects window.  "
             "Export the audio (using the menu button) to "
             "permanently apply effects."))
         self.menu_button.setToolTip(
             _("This menu can export the audio or perform "
             "various operations."))
         self.history_button.setToolTip(
             _("Use this button to view or open files that "
             "were previously opened during this session."))
     else:
         self.sample_graph.setToolTip("")
         self.fx_button.setToolTip("")
         self.menu_button.setToolTip("")
         self.history_button.setToolTip("")
Example #29
0
def global_new_project(a_project_file):
    global PROJECT, PLUGIN_RACK
    PROJECT = WaveNextProject(global_pydaw_with_audio)
    PROJECT.new_project(a_project_file)
    WAVE_EDITOR.last_offline_dir = libmk.PROJECT.user_folder
    MAIN_WINDOW.last_offline_dir = libmk.PROJECT.user_folder
    MAIN_WINDOW.notes_tab.setText("")
    WAVE_EDITOR.open_project()
    PLUGIN_RACK = PluginRack(PROJECT, 0, PluginSettingsWaveEditor)
    MAIN_WINDOW.main_tabwidget.insertTab(1, PLUGIN_RACK.widget,
                                         _("Plugin Rack"))
Example #30
0
 def on_ok():
     f_txt = str(f_name_lineedit.text()).strip()
     if not f_txt:
         QMessageBox.warning(
             MAIN_WINDOW, _("Error"), _("Name cannot be empty"))
         return
     for x in ("\\", "/", "~", "|"):
         if x in f_txt:
             QMessageBox.warning(
                 MAIN_WINDOW, _("Error"),
                 _("Invalid char '{}'".format(x)))
             return
     for f_i, f_ai in zip(
     range(len(self.audio_inputs.inputs)), self.audio_inputs.inputs):
         f_val = f_ai.get_value()
         if f_val.rec:
             f_path = os.path.join(
                 libmk.PROJECT.audio_tmp_folder, "{}.wav".format(f_i))
             if os.path.isfile(f_path):
                 f_file_name = "-".join(
                     str(x) for x in (f_txt, f_i, f_ai.get_name()))
                 f_new_path = os.path.join(
                     libmk.PROJECT.audio_rec_folder, f_file_name)
                 if f_new_path.lower().endswith(".wav"):
                     f_new_path = f_new_path[:-4]
                 if os.path.exists(f_new_path + ".wav"):
                     for f_i in range(10000):
                         f_tmp = "{}-{}.wav".format(f_new_path, f_i)
                         if not os.path.exists(f_tmp):
                             f_new_path = f_tmp
                             break
                 else:
                     f_new_path += ".wav"
                 shutil.move(f_path, f_new_path)
             else:
                 print("Error, path did not exist: {}".format(f_path))
     self.copy_path_to_clipboard = f_copy_path_checkbox.isChecked()
     if self.copy_path_to_clipboard:
         f_clipboard = libmk.APP.clipboard()
         f_clipboard.setText(libmk.PROJECT.audio_rec_folder)
     f_window.close()
Example #31
0
    def __init__(self,
                 a_set_plugin_func,
                 a_index,
                 a_track_num,
                 a_save_callback,
                 a_qcbox=False,
                 a_is_mixer=False):
        self.is_mixer = a_is_mixer
        self.plugin_ui = None
        self.set_plugin_func = a_set_plugin_func
        self.vlayout = QVBoxLayout()
        self.suppress_osc = False
        self.save_callback = a_save_callback
        self.plugin_uid = -1
        self.track_num = a_track_num
        self.index = a_index
        self.plugin_index = None

        self.qcbox = a_qcbox
        if a_qcbox:
            self.plugin_combobox = QComboBox()
        else:
            self.plugin_combobox = PluginComboBox(
                self.on_plugin_combobox_change)
        self.plugin_combobox.setMinimumWidth(150)
        self.plugin_combobox.wheelEvent = self.wheel_event

        self.plugin_combobox.addItems(self.plugin_list)

        if a_qcbox:
            self.plugin_combobox.currentIndexChanged.connect(
                self.on_plugin_combobox_change)

        self.power_checkbox = QCheckBox()
        self.power_checkbox.setObjectName("button_power")
        self.power_checkbox.setChecked(True)

        if self.is_mixer:
            self.vlayout.addWidget(self.plugin_combobox)
            self.vlayout.setAlignment(self.plugin_combobox, QtCore.Qt.AlignTop)
            self.spacer = QSpacerItem(1, 1, QSizePolicy.Minimum,
                                      QSizePolicy.Expanding)
            self.vlayout.addItem(self.spacer)
        else:
            self.controls_widget = QWidget()
            self.controls_widget.setObjectName("plugin_rack")
            self.layout = QHBoxLayout(self.controls_widget)
            self.layout.setContentsMargins(3, 3, 3, 3)
            self.layout.addWidget(QLabel(_("Plugin")))
            self.vlayout.addWidget(self.controls_widget)
            self.layout.addWidget(self.plugin_combobox)
            self.power_checkbox.clicked.connect(self.on_power_changed)
            self.layout.addWidget(self.power_checkbox)
Example #32
0
        def ok_handler():
            if str(f_name.text()) == "":
                QMessageBox.warning(f_window, _("Error"),
                                    _("Name cannot be empty"))
                return

            if f_copy_to_clipboard_checkbox.isChecked():
                self.copy_to_clipboard_checked = True
                f_clipboard = QApplication.clipboard()
                f_clipboard.setText(f_name.text())
            else:
                self.copy_to_clipboard_checked = False

            f_file_name = str(f_name.text())
            PROJECT.IPC.pydaw_we_export(f_file_name)
            self.last_offline_dir = os.path.dirname(f_file_name)
            self.open_exported = f_open_exported.isChecked()
            f_window.close()
            libmk.MAIN_WINDOW.show_offline_rendering_wait_window(f_file_name)
            if self.open_exported:
                self.open_file(f_file_name)
Example #33
0
        def ok_handler():
            if str(f_name.text()) == "":
                QMessageBox.warning(
                    f_window, _("Error"), _("Name cannot be empty"))
                return

            if f_copy_to_clipboard_checkbox.isChecked():
                self.copy_to_clipboard_checked = True
                f_clipboard = QApplication.clipboard()
                f_clipboard.setText(f_name.text())
            else:
                self.copy_to_clipboard_checked = False

            f_file_name = str(f_name.text())
            PROJECT.wn_osc.pydaw_we_export(f_file_name)
            self.last_offline_dir = os.path.dirname(f_file_name)
            self.open_exported = f_open_exported.isChecked()
            f_window.close()
            libmk.MAIN_WINDOW.show_offline_rendering_wait_window(f_file_name)
            if self.open_exported:
                self.open_file(f_file_name)
Example #34
0
 def update_engine(self, a_check=True):
     if not self.suppress_osc:
         f_graph = self.get_rg_func()
         if not self.track_num in f_graph.graph:
             f_graph.graph[self.track_num] = {}
         f_index = self.bus_combobox.currentIndex() - 1
         if a_check and f_index != -1:
             f_feedback = f_graph.check_for_feedback(
                 f_index, self.track_num, self.index)
             if f_feedback:
                 QMessageBox.warning(
                     self.bus_combobox, _("Error"),
                     _("Can't set the route, it would create "
                     "a feedback loop"))
                 self.suppress_osc = True
                 self.bus_combobox.setCurrentIndex(self.last_value)
                 self.suppress_osc = False
                 return
         f_graph.graph[self.track_num][self.index] = self.get_value()
         self.save_rg_func(f_graph)
         self.last_value = self.bus_combobox.currentIndex()
Example #35
0
    def __init__(self, a_set_plugin_func, a_index, a_track_num,
                 a_save_callback):
        self.plugin_list = MAIN_PLUGIN_NAMES

        self.menu_button = QPushButton(_("Menu"))
        self.menu = QMenu()
        self.menu_button.setMenu(self.menu)
        f_copy_action = self.menu.addAction(_("Copy"))
        f_copy_action.triggered.connect(self.copy)
        f_paste_action = self.menu.addAction(_("Paste"))
        f_paste_action.triggered.connect(self.paste)
        self.menu.addSeparator()
        f_cut_action = self.menu.addAction(_("Cut"))
        f_cut_action.triggered.connect(self.cut)
        self.menu.addSeparator()
        f_clear_action = self.menu.addAction(_("Clear"))
        f_clear_action.triggered.connect(self.clear)

        AbstractPluginSettings.__init__(self,
                                        a_set_plugin_func,
                                        a_index,
                                        a_track_num,
                                        a_save_callback,
                                        a_qcbox=False)

        self.hide_checkbox = QCheckBox()
        self.hide_checkbox.setObjectName("button_hide")
        self.hide_checkbox.setToolTip(_("Hide"))
        self.layout.addWidget(self.hide_checkbox)
        self.hide_checkbox.setEnabled(False)
        self.hide_checkbox.stateChanged.connect(self.hide_checkbox_changed)

        self.layout.addItem(QSpacerItem(1, 1, QSizePolicy.Expanding))
Example #36
0
    def __init__(
            self, a_set_plugin_func, a_index, a_track_num, a_save_callback):
        self.plugin_list = MAIN_PLUGIN_NAMES

        self.menu_button = QPushButton(_("Menu"))
        self.menu = QMenu()
        self.menu_button.setMenu(self.menu)
        f_copy_action = self.menu.addAction(_("Copy"))
        f_copy_action.triggered.connect(self.copy)
        f_paste_action = self.menu.addAction(_("Paste"))
        f_paste_action.triggered.connect(self.paste)
        self.menu.addSeparator()
        f_cut_action = self.menu.addAction(_("Cut"))
        f_cut_action.triggered.connect(self.cut)
        self.menu.addSeparator()
        f_clear_action = self.menu.addAction(_("Clear"))
        f_clear_action.triggered.connect(self.clear)

        AbstractPluginSettings.__init__(
            self, a_set_plugin_func, a_index, a_track_num, a_save_callback,
            a_qcbox=False)

        self.hide_checkbox = QCheckBox()
        self.hide_checkbox.setObjectName("button_hide")
        self.hide_checkbox.setToolTip(_("Hide"))
        self.layout.addWidget(self.hide_checkbox)
        self.hide_checkbox.setEnabled(False)
        self.hide_checkbox.stateChanged.connect(self.hide_checkbox_changed)

        self.layout.addItem(QSpacerItem(1, 1, QSizePolicy.Expanding))
Example #37
0
    def __init__(self, *args, **kwargs):
        pydaw_abstract_plugin_ui.__init__(self, *args, **kwargs)
        self._plugin_name = "MK Vocoder"
        self.is_instrument = False
        self.layout.setSizeConstraint(QLayout.SetFixedSize)
        f_knob_size = DEFAULT_KNOB_SIZE
        self.widget.setMinimumHeight(120)

        self.hlayout = QHBoxLayout()
        self.layout.addLayout(self.hlayout)
        self.groupbox_gridlayout = QGridLayout()
        self.hlayout.addLayout(self.groupbox_gridlayout)

        self.wet_knob = pydaw_knob_control(f_knob_size, _("Wet"),
                                           MK_VOCODER_WET,
                                           self.plugin_rel_callback,
                                           self.plugin_val_callback, -500, 0,
                                           0, KC_TENTH, self.port_dict)
        self.wet_knob.add_to_grid_layout(self.groupbox_gridlayout, 3)

        self.modulator_knob = pydaw_knob_control(f_knob_size, _("Modulator"),
                                                 MK_VOCODER_MODULATOR,
                                                 self.plugin_rel_callback,
                                                 self.plugin_val_callback,
                                                 -500, 0, -500, KC_TENTH,
                                                 self.port_dict)
        self.modulator_knob.add_to_grid_layout(self.groupbox_gridlayout, 9)

        self.carrier_knob = pydaw_knob_control(f_knob_size, _("Carrier"),
                                               MK_VOCODER_CARRIER,
                                               self.plugin_rel_callback,
                                               self.plugin_val_callback, -500,
                                               0, -500, KC_TENTH,
                                               self.port_dict)
        self.carrier_knob.add_to_grid_layout(self.groupbox_gridlayout, 6)

        self.hlayout.addWidget(QLabel(MK_VOCODER_TEXT))

        self.open_plugin_file()
        self.set_midi_learn(MK_VOCODER_PORT_MAP)
Example #38
0
 def on_ok():
     f_txt = str(f_name_lineedit.text()).strip()
     if not f_txt:
         QMessageBox.warning(MAIN_WINDOW, _("Error"),
                             _("Name cannot be empty"))
         return
     for x in ("\\", "/", "~", "|"):
         if x in f_txt:
             QMessageBox.warning(MAIN_WINDOW, _("Error"),
                                 _("Invalid char '{}'".format(x)))
             return
     for f_i, f_ai in zip(range(len(self.audio_inputs.inputs)),
                          self.audio_inputs.inputs):
         f_val = f_ai.get_value()
         if f_val.rec:
             f_path = os.path.join(libmk.PROJECT.audio_tmp_folder,
                                   "{}.wav".format(f_i))
             if os.path.isfile(f_path):
                 f_file_name = "-".join(
                     str(x) for x in (f_txt, f_i, f_ai.get_name()))
                 f_new_path = os.path.join(
                     libmk.PROJECT.audio_rec_folder, f_file_name)
                 if f_new_path.lower().endswith(".wav"):
                     f_new_path = f_new_path[:-4]
                 if os.path.exists(f_new_path + ".wav"):
                     for f_i in range(10000):
                         f_tmp = "{}-{}.wav".format(f_new_path, f_i)
                         if not os.path.exists(f_tmp):
                             f_new_path = f_tmp
                             break
                 else:
                     f_new_path += ".wav"
                 shutil.move(f_path, f_new_path)
             else:
                 print("Error, path did not exist: {}".format(f_path))
     self.open_rec_dir = f_open_rec_dir_checkbox.isChecked()
     if self.open_rec_dir:
         WAVE_EDITOR.file_browser.set_folder(
             libmk.PROJECT.audio_rec_folder)
     f_window.close()
Example #39
0
 def set_selected_as_project(self):
     f_items = self.selectedItems()
     if f_items and len(f_items) == 1:
         f_project_dir = os.path.join(self.project_dir, "projects")
         f_tmp_dir = "{}-tmp-{}".format(
             f_project_dir,
             datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S"))
         f_item = f_items[0]
         f_tar_path = os.path.join(
             self.backup_dir, "{}.tar.bz2".format(f_item.text(0)))
         shutil.move(f_project_dir, f_tmp_dir)
         with tarfile.open(f_tar_path, "r:bz2") as f_tar:
             f_tar.extractall(self.project_dir)
         self.project_data["CURRENT"] = f_item.node_path
         with open(self.backup_file, "w", newline="\n") as f_handle:
             json.dump(
                 self.project_data, f_handle, sort_keys=True,
                 indent=4, separators=(',', ': '))
         shutil.rmtree(f_tmp_dir)
         QMessageBox.warning(
             self, _("Complete"),
             _("Reverted project to {}".format(f_item.node_path)))
         self.draw_tree()
Example #40
0
def global_open_project(a_project_file):
    global PROJECT, TRACK_NAMES, PLUGIN_RACK
    PROJECT = WaveNextProject(global_pydaw_with_audio)
    PROJECT.suppress_updates = True
    PROJECT.open_project(a_project_file, False)
    WAVE_EDITOR.last_offline_dir = libmk.PROJECT.user_folder
    PROJECT.suppress_updates = False
    MAIN_WINDOW.last_offline_dir = libmk.PROJECT.user_folder
    MAIN_WINDOW.notes_tab.setText(PROJECT.get_notes())
    WAVE_EDITOR.open_project()
    TRANSPORT.open_project()
    PLUGIN_RACK = PluginRack(PROJECT, 0, PluginSettingsWaveEditor)
    MAIN_WINDOW.main_tabwidget.insertTab(1, PLUGIN_RACK.widget,
                                         _("Plugin Rack"))
Example #41
0
    def __init__(self, a_val_callback, a_project,
                 a_folder, a_plugin_uid, a_track_name, a_stylesheet,
                 a_configure_callback, a_midi_learn_callback,
                 a_cc_map_callback):
        pydaw_abstract_plugin_ui.__init__(
            self, a_val_callback, a_project, a_plugin_uid, a_stylesheet,
            a_configure_callback, a_folder, a_midi_learn_callback,
            a_cc_map_callback)
        self._plugin_name = "MODULEX"
        self.set_window_title(a_track_name)
        self.is_instrument = False

        self.preset_manager = pydaw_preset_manager_widget(
            self.get_plugin_name())
        self.presets_hlayout = QHBoxLayout()
        self.presets_hlayout.addWidget(self.preset_manager.group_box)
        self.presets_hlayout.addItem(
            QSpacerItem(1, 1, QSizePolicy.Expanding))
        self.layout.addLayout(self.presets_hlayout)
        self.spectrum_enabled = None
        self.tab_widget = QTabWidget()
        self.layout.addWidget(self.tab_widget)
        self.layout.setSizeConstraint(QLayout.SetFixedSize)

        self.fx_tab = QWidget()
        self.tab_widget.addTab(self.fx_tab, _("Effects"))
        self.fx_layout = QGridLayout()
        self.fx_hlayout = QHBoxLayout(self.fx_tab)
        self.fx_hlayout.addLayout(self.fx_layout)

        f_knob_size = 48

        f_port = 4
        f_column = 0
        f_row = 0
        for f_i in range(8):
            f_effect = pydaw_modulex_single(
                "FX{}".format(f_i), f_port,
                self.plugin_rel_callback, self.plugin_val_callback,
                self.port_dict, self.preset_manager, a_knob_size=f_knob_size)
            self.effects.append(f_effect)
            self.fx_layout.addWidget(f_effect.group_box, f_row, f_column)
            f_column += 1
            if f_column > 1:
                f_column = 0
                f_row += 1
            f_port += 4

        self.open_plugin_file()
        self.set_midi_learn(MODULEX_PORT_MAP)
Example #42
0
    def __init__(
            self, a_set_plugin_func, a_index, a_track_num,
            a_save_callback, a_qcbox=False, a_is_mixer=False):
        self.is_mixer = a_is_mixer
        self.plugin_ui = None
        self.set_plugin_func = a_set_plugin_func
        self.vlayout = QVBoxLayout()
        self.suppress_osc = False
        self.save_callback = a_save_callback
        self.plugin_uid = -1
        self.track_num = a_track_num
        self.index = a_index
        self.plugin_index = None

        self.qcbox = a_qcbox
        if a_qcbox:
            self.plugin_combobox = QComboBox()
        else:
            self.plugin_combobox = PluginComboBox(
                self.on_plugin_combobox_change)
        self.plugin_combobox.setMinimumWidth(150)
        self.plugin_combobox.wheelEvent = self.wheel_event

        self.plugin_combobox.addItems(self.plugin_list)

        if a_qcbox:
            self.plugin_combobox.currentIndexChanged.connect(
                self.on_plugin_combobox_change)

        self.power_checkbox = QCheckBox()
        self.power_checkbox.setObjectName("button_power")
        self.power_checkbox.setChecked(True)

        if self.is_mixer:
            self.vlayout.addWidget(self.plugin_combobox)
            self.vlayout.setAlignment(self.plugin_combobox, QtCore.Qt.AlignTop)
            self.spacer = QSpacerItem(
                1, 1, QSizePolicy.Minimum, QSizePolicy.Expanding)
            self.vlayout.addItem(self.spacer)
        else:
            self.controls_widget = QWidget()
            self.controls_widget.setObjectName("plugin_rack")
            self.layout = QHBoxLayout(self.controls_widget)
            self.layout.setContentsMargins(3, 3, 3, 3)
            self.layout.addWidget(QLabel(_("Plugin")))
            self.vlayout.addWidget(self.controls_widget)
            self.layout.addWidget(self.plugin_combobox)
            self.power_checkbox.clicked.connect(self.on_power_changed)
            self.layout.addWidget(self.power_checkbox)
Example #43
0
    def __init__(
            self, a_set_plugin_func, a_index, a_track_num,
            a_layout, a_save_callback, a_name_callback,
            a_automation_callback, a_offset=0, a_send=None):
        self.plugin_list = MAIN_PLUGIN_NAMES

        self.menu_button = QPushButton(_("Menu"))
        self.menu = QMenu()
        self.menu_button.setMenu(self.menu)
        f_copy_action = self.menu.addAction(_("Copy"))
        f_copy_action.triggered.connect(self.copy)
        f_paste_action = self.menu.addAction(_("Paste"))
        f_paste_action.triggered.connect(self.paste)
        self.menu.addSeparator()
        f_cut_action = self.menu.addAction(_("Cut"))
        f_cut_action.triggered.connect(self.cut)
        self.menu.addSeparator()
        f_clear_action = self.menu.addAction(_("Clear"))
        f_clear_action.triggered.connect(self.clear)

        plugin_settings_base.__init__(
            self, a_set_plugin_func, a_index, a_track_num, a_layout,
            a_save_callback, a_name_callback,
            a_automation_callback, a_offset, a_send)
Example #44
0
 def set_selected_as_project(self):
     f_items = self.selectedItems()
     if f_items and len(f_items) == 1:
         f_project_dir = os.path.join(self.project_dir, "projects")
         f_tmp_dir = "{}-tmp-{}".format(
             f_project_dir,
             datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S"))
         f_item = f_items[0]
         f_tar_path = os.path.join(self.backup_dir, f_item.text(0))
         shutil.move(f_project_dir, f_tmp_dir)
         with tarfile.open(f_tar_path, "r:bz2") as f_tar:
             f_tar.extractall(self.project_dir)
         self.project_data["CURRENT"] = f_item.node_path
         with open(self.backup_file, "w", newline="\n") as f_handle:
             json.dump(self.project_data,
                       f_handle,
                       sort_keys=True,
                       indent=4,
                       separators=(',', ': '))
         shutil.rmtree(f_tmp_dir)
         QMessageBox.warning(
             self, _("Complete"),
             _("Reverted project to {}".format(f_item.node_path)))
         self.draw_tree()
Example #45
0
 def file_name_select():
     try:
         if not os.path.isdir(self.last_offline_dir):
             self.last_offline_dir = global_home
         f_file_name, f_filter = QFileDialog.getSaveFileName(
             f_window, _("Select a file name to save to..."),
             self.last_offline_dir)
         f_file_name = str(f_file_name)
         if not f_file_name is None and f_file_name != "":
             if not f_file_name.endswith(".wav"):
                 f_file_name += ".wav"
             if not f_file_name is None and not str(f_file_name) == "":
                 f_name.setText(f_file_name)
             self.last_offline_dir = os.path.dirname(f_file_name)
     except Exception as ex:
         libmk.pydaw_print_generic_exception(ex)
Example #46
0
 def file_name_select():
     try:
         if not os.path.isdir(self.last_offline_dir):
             self.last_offline_dir = global_home
         f_file_name, f_filter = QFileDialog.getSaveFileName(
             f_window, _("Select a file name to save to..."),
             self.last_offline_dir)
         f_file_name = str(f_file_name)
         if not f_file_name is None and f_file_name != "":
             if not f_file_name.endswith(".wav"):
                 f_file_name += ".wav"
             if not f_file_name is None and not str(f_file_name) == "":
                 f_name.setText(f_file_name)
             self.last_offline_dir = os.path.dirname(f_file_name)
     except Exception as ex:
         libmk.pydaw_print_generic_exception(ex)
Example #47
0
 def __init__(self):
     self.widget = QWidget()
     self.main_layout = QVBoxLayout(self.widget)
     self.layout = QGridLayout()
     self.main_layout.addWidget(QLabel(_("Audio Inputs")))
     self.main_layout.addLayout(self.layout)
     f_labels = (_("Name"), _("Rec."), _("Mon."), _("Gain"), _("Stereo"))
     for f_i, f_label in zip(range(len(f_labels)), f_labels):
         self.layout.addWidget(QLabel(f_label), 0, f_i)
     self.inputs = []
     f_count = 0
     if "audioInputs" in pydaw_util.global_device_val_dict:
         f_count = int(pydaw_util.global_device_val_dict["audioInputs"])
     for f_i in range(f_count):
         f_input = AudioInput(f_i, self.layout, self.callback, f_count - 1)
         self.inputs.append(f_input)
Example #48
0
 def __init__(self):
     self.widget = QWidget()
     self.main_layout = QVBoxLayout(self.widget)
     self.layout = QGridLayout()
     self.main_layout.addWidget(QLabel(_("Audio Inputs")))
     self.main_layout.addLayout(self.layout)
     f_labels = (
         _("Name"), _("Rec."), _("Mon."), _("Gain"), _("Stereo"))
     for f_i, f_label in zip(range(len(f_labels)), f_labels):
         self.layout.addWidget(QLabel(f_label), 0, f_i)
     self.inputs = []
     f_count = 0
     if "audioInputs" in pydaw_util.global_device_val_dict:
         f_count = int(pydaw_util.global_device_val_dict["audioInputs"])
     for f_i in range(f_count):
         f_input = AudioInput(f_i, self.layout, self.callback, f_count - 1)
         self.inputs.append(f_input)
Example #49
0
the Free Software Foundation version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

"""

from libpydaw.translate import _

audio_viewer_widget_folders = _(
    """Click 'Menu->Show Tooltips' in the transport to disable these tooltips

Use this tab to browse your folders and files.
Drag and drop one file at a time onto the sequencer.
.wav and .aiff files are the only supported audio file format.
Click the 'Bookmark' button to save the current folder to your
bookmarks located on the 'Bookmarks' tab.
""")

audio_viewer_widget_modulex = _("""This tab allows you to set effects per-item.
The tab is only enabled when you have exactly one item selected,
the copy and paste buttons allow you to copy settings between
multipe items.""")

timestretch_modes = _("""Modes:
None:  No stretching or pitch adjustment

Pitch affecting time:  Repitch the item, it will become
shorter at higher pitches, and longer at lower pitches
Example #50
0
    def __init__(self, *args, **kwargs):
        pydaw_abstract_plugin_ui.__init__(self, *args, **kwargs)
        self._plugin_name = "MK Compressor"
        self.is_instrument = False

        self.preset_manager = None
        self.layout.setSizeConstraint(QLayout.SetFixedSize)

        self.delay_hlayout = QHBoxLayout()
        self.layout.addLayout(self.delay_hlayout)

        f_knob_size = DEFAULT_KNOB_SIZE

        self.groupbox_gridlayout = QGridLayout()
        self.delay_hlayout.addLayout(self.groupbox_gridlayout)

        self.thresh_knob = pydaw_knob_control(
            f_knob_size, _("Thresh"), MK_COMP_THRESHOLD,
            self.plugin_rel_callback, self.plugin_val_callback, -360, -60,
            -240, KC_TENTH, self.port_dict, self.preset_manager)
        self.thresh_knob.add_to_grid_layout(self.groupbox_gridlayout, 3)

        self.ratio_knob = pydaw_knob_control(f_knob_size, _("Ratio"),
                                             MK_COMP_RATIO,
                                             self.plugin_rel_callback,
                                             self.plugin_val_callback, 10, 100,
                                             20, KC_TENTH, self.port_dict,
                                             self.preset_manager)
        self.ratio_knob.add_to_grid_layout(self.groupbox_gridlayout, 7)

        self.knee_knob = pydaw_knob_control(f_knob_size, _("Knee"),
                                            MK_COMP_KNEE,
                                            self.plugin_rel_callback,
                                            self.plugin_val_callback, 0, 120,
                                            0, KC_TENTH, self.port_dict,
                                            self.preset_manager)
        self.knee_knob.add_to_grid_layout(self.groupbox_gridlayout, 15)

        self.attack_knob = pydaw_knob_control(
            f_knob_size, _("Attack"), MK_COMP_ATTACK, self.plugin_rel_callback,
            self.plugin_val_callback, 0, 500, 50, KC_MILLISECOND,
            self.port_dict, self.preset_manager)
        self.attack_knob.add_to_grid_layout(self.groupbox_gridlayout, 21)

        self.release_knob = pydaw_knob_control(
            f_knob_size, _("Release"), MK_COMP_RELEASE,
            self.plugin_rel_callback, self.plugin_val_callback, 10, 500, 100,
            KC_MILLISECOND, self.port_dict, self.preset_manager)
        self.release_knob.add_to_grid_layout(self.groupbox_gridlayout, 22)

        self.gain_knob = pydaw_knob_control(f_knob_size, _("Gain"),
                                            MK_COMP_GAIN,
                                            self.plugin_rel_callback,
                                            self.plugin_val_callback, -360,
                                            360, 0, KC_TENTH, self.port_dict,
                                            self.preset_manager)
        self.gain_knob.add_to_grid_layout(self.groupbox_gridlayout, 30)

        self.mono_combobox = pydaw_combobox_control(
            90, _("Mode"), MK_COMP_MODE, self.plugin_rel_callback,
            self.plugin_val_callback, [_("Peak"), _("RMS")], self.port_dict, 0,
            self.preset_manager)
        self.mono_combobox.add_to_grid_layout(self.groupbox_gridlayout, 36)

        self.rms_time_knob = pydaw_knob_control(f_knob_size, _("RMS Time"),
                                                MK_COMP_RMS_TIME,
                                                self.plugin_rel_callback,
                                                self.plugin_val_callback, 1, 5,
                                                2, KC_DECIMAL, self.port_dict,
                                                self.preset_manager)
        self.rms_time_knob.add_to_grid_layout(self.groupbox_gridlayout, 37)

        self.peak_meter = peak_meter(16, False)
        self.delay_hlayout.addWidget(self.peak_meter.widget)

        self.ui_msg_enabled = pydaw_null_control(MK_COMP_UI_MSG_ENABLED,
                                                 self.plugin_rel_callback,
                                                 self.plugin_val_callback, 0,
                                                 self.port_dict)

        self.open_plugin_file()
        self.set_midi_learn(MK_COMP_PORT_MAP)
        self.enable_ui_msg(True)
Example #51
0
    def __init__(self, *args, **kwargs):
        pydaw_abstract_plugin_ui.__init__(self, *args, **kwargs)
        self._plugin_name = "MKDELAY"
        self.is_instrument = False

        self.layout.setSizeConstraint(QLayout.SetFixedSize)

        self.delay_hlayout = QHBoxLayout()
        self.layout.addLayout(self.delay_hlayout)

        f_knob_size = DEFAULT_KNOB_SIZE
        self.preset_manager = None

        self.delay_gridlayout = QGridLayout()
        self.delay_hlayout.addLayout(self.delay_gridlayout)

        self.delay_time_knob = pydaw_knob_control(
            f_knob_size, _("Time"), MKDELAY_DELAY_TIME,
            self.plugin_rel_callback, self.plugin_val_callback, 10, 100, 50,
            KC_TIME_DECIMAL, self.port_dict, self.preset_manager)
        self.delay_time_knob.add_to_grid_layout(self.delay_gridlayout, 0)
        self.feedback = pydaw_knob_control(f_knob_size, _("Fdbk"),
                                           MKDELAY_FEEDBACK,
                                           self.plugin_rel_callback,
                                           self.plugin_val_callback, -200, 0,
                                           -120, KC_TENTH, self.port_dict,
                                           self.preset_manager)
        self.feedback.add_to_grid_layout(self.delay_gridlayout, 1)
        self.dry_knob = pydaw_knob_control(f_knob_size, _("Dry"), MKDELAY_DRY,
                                           self.plugin_rel_callback,
                                           self.plugin_val_callback, -300, 0,
                                           0, KC_TENTH, self.port_dict,
                                           self.preset_manager)
        self.dry_knob.add_to_grid_layout(self.delay_gridlayout, 2)
        self.wet_knob = pydaw_knob_control(f_knob_size, _("Wet"), MKDELAY_WET,
                                           self.plugin_rel_callback,
                                           self.plugin_val_callback, -300, 0,
                                           -120, KC_TENTH, self.port_dict,
                                           self.preset_manager)
        self.wet_knob.add_to_grid_layout(self.delay_gridlayout, 3)
        self.duck_knob = pydaw_knob_control(f_knob_size, _("Duck"),
                                            MKDELAY_DUCK,
                                            self.plugin_rel_callback,
                                            self.plugin_val_callback, -40, 0,
                                            0, KC_INTEGER, self.port_dict,
                                            self.preset_manager)
        self.duck_knob.add_to_grid_layout(self.delay_gridlayout, 4)
        self.cutoff_knob = pydaw_knob_control(
            f_knob_size, _("Cutoff"), MKDELAY_CUTOFF, self.plugin_rel_callback,
            self.plugin_val_callback, 40, 118, 90, KC_PITCH, self.port_dict,
            self.preset_manager)
        self.cutoff_knob.add_to_grid_layout(self.delay_gridlayout, 5)
        self.stereo_knob = pydaw_knob_control(f_knob_size, _("Stereo"),
                                              MKDELAY_STEREO,
                                              self.plugin_rel_callback,
                                              self.plugin_val_callback, 0, 100,
                                              100, KC_DECIMAL, self.port_dict,
                                              self.preset_manager)
        self.stereo_knob.add_to_grid_layout(self.delay_gridlayout, 6)

        self.open_plugin_file()
        self.set_midi_learn(MKDELAY_PORT_MAP)
Example #52
0
"""

from libpydaw.pydaw_widgets import *
from libpydaw.translate import _

XFADE_SLIDER = 0
XFADE_MIDPOINT = 1

XFADE_PORT_MAP = {
    "X-Fade": XFADE_SLIDER,
}

XFADE_TOOLTIP = _("""\
Connect one or more tracks to the regular input of this track, and one or
more tracks to the sidechain input of this track, then use the fader to
crossfade between them.
""")


class xfade_plugin_ui(pydaw_abstract_plugin_ui):
    def __init__(self, *args, **kwargs):
        pydaw_abstract_plugin_ui.__init__(self, *args, **kwargs)
        self._plugin_name = "XFADE"
        self.is_instrument = False
        self.layout.setSizeConstraint(QLayout.SetFixedSize)
        f_knob_size = DEFAULT_KNOB_SIZE

        self.hlayout = QHBoxLayout()
        self.layout.addLayout(self.hlayout)
Example #53
0
sequencer = _(
"""Click 'Menu->Show Tooltips' in the transport to disable these tooltips

This is sequencer, it consists of items, tracks and automation.
Click on the timeline at the top of the sequencer to set playback position,
or right-click the timeline to set various markers.

Tracks:

A track can be any/all of: instrument, audio, bus or send.
An item can contain MIDI data (notes, CCs, pitchbend) and/or one or
more audio files.

Items:

CTRL+click to add a new item

Select multiple items or automation points using CTRL+click+drag
(automation points only allow selecting from one track at a time)

Double click an item to open it in the item editor

The term 'unlink' means to create a new copy of the item that does not
change it's parent item when edited. (by default all items are
'ghost items' that update all items with the same name)

See the right-click context menu for additional actions and keyboard shortcuts.

Automation:

An automation point moves a control on a plugin.  The automation points are
steppy, you must smooth the points to get a continuous line by selecting
points using CTRL+drag and pressing ALT+s.

Shift+click+drag to cut/delete automation points

See the right-click context menu for additional actions and keyboard shortcuts.

Toggle collapsing the file browser with CTRL+right_arrow
""")
Example #54
0
def pydaw_print_generic_exception(a_ex):
    QMessageBox.warning(
        MAIN_WINDOW, _("Warning"),
        _("The following error happened:\n{}").format(a_ex))
Example #55
0
from libpydaw.pydaw_widgets import *
from libpydaw.translate import _

MK_VOCODER_WET = 0
MK_VOCODER_MODULATOR = 1
MK_VOCODER_CARRIER = 2

MK_VOCODER_PORT_MAP = {
    "Wet": MK_VOCODER_WET,
    "Modulator": MK_VOCODER_MODULATOR,
    "Carrier": MK_VOCODER_CARRIER,
}

MK_VOCODER_TEXT = _("""Route the carrier signal to the plugin's main input,
and route the modulator signal to the track's
sidechain input.""")


class mk_vocoder_plugin_ui(pydaw_abstract_plugin_ui):
    def __init__(self, *args, **kwargs):
        pydaw_abstract_plugin_ui.__init__(self, *args, **kwargs)
        self._plugin_name = "MK Vocoder"
        self.is_instrument = False
        self.layout.setSizeConstraint(QLayout.SetFixedSize)
        f_knob_size = DEFAULT_KNOB_SIZE
        self.widget.setMinimumHeight(120)

        self.hlayout = QHBoxLayout()
        self.layout.addLayout(self.hlayout)
        self.groupbox_gridlayout = QGridLayout()
Example #56
0
"""

from libpydaw.pydaw_widgets import *
from libpydaw.translate import _

XFADE_SLIDER = 0
XFADE_MIDPOINT = 1

XFADE_PORT_MAP = {
    "X-Fade": XFADE_SLIDER,
}

XFADE_TOOLTIP = _("""To use the crossfader, connect one or more tracks
to the regular input of this track, and one or more tracks to the
sidechain input of this track.

When the fader is in the far left position, the regular tracks will pass
through, at the far right, the sidechain tracks will pass through.
""")

class xfade_plugin_ui(pydaw_abstract_plugin_ui):
    def __init__(self, a_val_callback, a_project,
                 a_folder, a_plugin_uid, a_track_name, a_stylesheet,
                 a_configure_callback, a_midi_learn_callback,
                 a_cc_map_callback):
        pydaw_abstract_plugin_ui.__init__(
            self, a_val_callback, a_project, a_plugin_uid, a_stylesheet,
            a_configure_callback, a_folder, a_midi_learn_callback,
            a_cc_map_callback)
        self._plugin_name = "XFADE"
        self.set_window_title(a_track_name)
Example #57
0
    def __init__(self, *args, **kwargs):
        pydaw_abstract_plugin_ui.__init__(self, *args, **kwargs)
        self._plugin_name = "RAYV2"
        self.is_instrument = True
        f_osc_types = [
            _("Off"), _("Saw"), _("Square"), _("H-Square"), _("Q-Square"),
            _("Triangle"), _("Sine")]
        f_lfo_types = [_("Off"), _("Sine"), _("Triangle")]
        self.preset_manager = pydaw_preset_manager_widget(
            self.get_plugin_name())
        self.main_layout = QVBoxLayout()
        self.main_layout.setContentsMargins(3, 3, 3, 3)
        self.layout.addLayout(self.main_layout)
        self.layout.setSizeConstraint(QLayout.SetFixedSize)
        self.hlayout0 = QHBoxLayout()
        self.main_layout.addLayout(self.hlayout0)
        self.hlayout0.addWidget(self.preset_manager.group_box)
        self.hlayout0.addItem(QSpacerItem(1, 1, QSizePolicy.Expanding))

        f_knob_size = 48

        self.hlayout1 = QHBoxLayout()
        self.main_layout.addLayout(self.hlayout1)
        self.osc1 = pydaw_osc_widget(
            f_knob_size, RAYV_OSC1_PITCH,
            RAYV_OSC1_TUNE, RAYV_OSC1_VOLUME,
            RAYV_OSC1_TYPE, f_osc_types,
            self.plugin_rel_callback, self.plugin_val_callback,
            _("Oscillator 1"), self.port_dict,
            a_preset_mgr=self.preset_manager, a_default_type=1,
            a_uni_voices_port=RAYV2_UNISON_VOICES1,
            a_uni_spread_port=RAYV2_UNISON_SPREAD1, a_pb_port=RAYV2_OSC1_PB)
        self.hlayout1.addWidget(self.osc1.group_box)
        self.adsr_amp = pydaw_adsr_widget(
            f_knob_size, True, RAYV_ATTACK, RAYV_DECAY,
            RAYV_SUSTAIN, RAYV_RELEASE,
            _("ADSR Amp"), self.plugin_rel_callback, self.plugin_val_callback,
            self.port_dict, self.preset_manager,
            a_prefx_port=RAYV_ADSR_PREFX, a_knob_type=KC_LOG_TIME,
            a_lin_port=RAYV2_ADSR_LIN_MAIN)
        self.hlayout1.addWidget(self.adsr_amp.groupbox)

        self.dist_widget = MultiDistWidget(
            f_knob_size, self.plugin_rel_callback, self.plugin_val_callback,
            self.port_dict, RAYV_DIST, RAYV_DIST_WET, RAYV2_DIST_OUTGAIN,
            RAYV2_DIST_TYPE, a_preset_mgr=self.preset_manager)
        self.hlayout1.addWidget(self.dist_widget.groupbox_dist)

        self.hlayout2 = QHBoxLayout()
        self.main_layout.addLayout(self.hlayout2)
        self.osc2 = pydaw_osc_widget(
            f_knob_size, RAYV_OSC2_PITCH,
            RAYV_OSC2_TUNE, RAYV_OSC2_VOLUME,
            RAYV_OSC2_TYPE, f_osc_types,
            self.plugin_rel_callback, self.plugin_val_callback,
            _("Oscillator 2"), self.port_dict, self.preset_manager,
            a_uni_voices_port=RAYV2_UNISON_VOICES2,
            a_uni_spread_port=RAYV2_UNISON_SPREAD2, a_pb_port=RAYV2_OSC2_PB)
        self.hlayout2.addWidget(self.osc2.group_box)

        self.adsr_filter = pydaw_adsr_widget(
            f_knob_size, False, RAYV_FILTER_ATTACK,
            RAYV_FILTER_DECAY, RAYV_FILTER_SUSTAIN,
            RAYV_FILTER_RELEASE, _("ADSR Filter"),
            self.plugin_rel_callback, self.plugin_val_callback,
            self.port_dict, self.preset_manager, a_knob_type=KC_LOG_TIME)
        self.hlayout2.addWidget(self.adsr_filter.groupbox)
        self.filter = pydaw_filter_widget(
            f_knob_size, self.plugin_rel_callback, self.plugin_val_callback,
            self.port_dict, RAYV_TIMBRE, RAYV_RES,
            a_preset_mgr=self.preset_manager, a_type_port=RAYV2_FILTER_TYPE)
        self.hlayout2.addWidget(self.filter.groupbox)
        self.filter_env_amt = pydaw_knob_control(
            f_knob_size, _("Env Amt"), RAYV_FILTER_ENV_AMT,
            self.plugin_rel_callback, self.plugin_val_callback,
            -100, 100, 0, KC_INTEGER, self.port_dict, self.preset_manager)
        self.filter_env_amt.add_to_grid_layout(self.filter.layout, 10)
        self.filter_keytrk = pydaw_knob_control(
            f_knob_size, _("KeyTrk"), RAYV_FILTER_KEYTRK,
            self.plugin_rel_callback, self.plugin_val_callback,
            0, 100, 0, KC_NONE, self.port_dict, self.preset_manager)
        self.filter_keytrk.add_to_grid_layout(self.filter.layout, 11)
        self.filter_velocity = pydaw_knob_control(
            f_knob_size, _("Vel."), RAYV2_FILTER_VELOCITY,
            self.plugin_rel_callback, self.plugin_val_callback,
            0, 100, 0, KC_NONE, self.port_dict, self.preset_manager)
        self.filter_velocity.add_to_grid_layout(self.filter.layout, 12)

        self.hlayout3 = QHBoxLayout()
        self.main_layout.addLayout(self.hlayout3)

        self.hard_sync = pydaw_checkbox_control(
            "Sync", RAYV_OSC_HARD_SYNC,
            self.plugin_rel_callback, self.plugin_val_callback,
            self.port_dict, self.preset_manager)
        self.hard_sync.control.setToolTip(
            _("Setting this hard sync's Osc1 to Osc2. Usually you "
            "would want to pitchbend Osc2 up if this is enabled."))
        self.osc2.grid_layout.addWidget(
            self.hard_sync.control, 1, 30, QtCore.Qt.AlignCenter)

        self.groupbox_noise = QGroupBox(_("Noise"))
        self.groupbox_noise.setObjectName("plugin_groupbox")
        self.noise_layout = QGridLayout(self.groupbox_noise)
        self.noise_layout.setContentsMargins(3, 3, 3, 3)
        self.hlayout1.addWidget(self.groupbox_noise)
        self.noise_amp = pydaw_knob_control(
            f_knob_size, _("Vol"), RAYV_NOISE_AMP,
            self.plugin_rel_callback, self.plugin_val_callback,
            -60, 0, -30, KC_INTEGER, self.port_dict, self.preset_manager)
        self.noise_amp.add_to_grid_layout(self.noise_layout, 0)

        self.noise_type = pydaw_combobox_control(
            87, _("Type"), RAYV2_NOISE_TYPE,
            self.plugin_rel_callback, self.plugin_val_callback,
            [_("Off"), _("White"), _("Pink")], self.port_dict,
             a_preset_mgr=self.preset_manager)
        self.noise_type.control.setMaximumWidth(87)
        self.noise_type.add_to_grid_layout(self.noise_layout, 1)


        self.master = pydaw_master_widget(
            f_knob_size, self.plugin_rel_callback, self.plugin_val_callback,
            RAYV_MASTER_VOLUME, RAYV_MASTER_GLIDE,
            RAYV_MASTER_PITCHBEND_AMT, self.port_dict, _("Master"),
            None, None,
            self.preset_manager, a_poly_port=RAYV_MONO_MODE,
            a_min_note_port=RAYV_MIN_NOTE, a_max_note_port=RAYV_MAX_NOTE,
            a_pitch_port=RAYV_MASTER_PITCH, a_pb_min=0)
        self.hlayout3.addWidget(self.master.group_box)

        self.lfo = pydaw_lfo_widget(
            f_knob_size, self.plugin_rel_callback, self.plugin_val_callback,
            self.port_dict, RAYV_LFO_FREQ,
            RAYV_LFO_TYPE, f_lfo_types, _("LFO"),
            self.preset_manager, RAYV_LFO_PHASE)
        self.hlayout3.addWidget(self.lfo.groupbox)

        self.pitch_env = pydaw_ramp_env_widget(
            f_knob_size, self.plugin_rel_callback, self.plugin_val_callback,
            self.port_dict, RAYV_PITCH_ENV_TIME,
            RAYV_PITCH_ENV_AMT, _("Pitch Env"),
            self.preset_manager, RAYV_RAMP_CURVE)
        self.hlayout3.addWidget(self.pitch_env.groupbox)

        self.lfo_amp = pydaw_knob_control(
            f_knob_size, _("Amp"), RAYV_LFO_AMP,
            self.plugin_rel_callback, self.plugin_val_callback,
            -24, 24, 0, KC_INTEGER, self.port_dict, self.preset_manager)
        self.lfo_amp.add_to_grid_layout(self.lfo.layout, 7)
        self.lfo_pitch = pydaw_knob_control(
            f_knob_size, _("Pitch"), RAYV_LFO_PITCH,
            self.plugin_rel_callback, self.plugin_val_callback,
            -36, 36, 0, KC_INTEGER, self.port_dict, self.preset_manager)
        self.lfo_pitch.add_to_grid_layout(self.lfo.layout, 8)

        self.lfo_pitch_fine = pydaw_knob_control(
            f_knob_size, _("Fine"), RAYV_LFO_PITCH_FINE,
            self.plugin_rel_callback, self.plugin_val_callback,
            -100, 100, 0, KC_DECIMAL, self.port_dict, self.preset_manager)
        self.lfo_pitch_fine.add_to_grid_layout(self.lfo.layout, 9)

        self.lfo_cutoff = pydaw_knob_control(
            f_knob_size, _("Filter"), RAYV_LFO_FILTER,
            self.plugin_rel_callback, self.plugin_val_callback,
            -48, 48, 0, KC_INTEGER, self.port_dict, self.preset_manager)
        self.lfo_cutoff.add_to_grid_layout(self.lfo.layout, 10)

        self.open_plugin_file()
        self.set_midi_learn(RAYV_PORT_MAP)
        def on_ok(a_self=None):
            if self.device_name == "default":
                f_warn_result = QMessageBox.question(
                    f_window, _("Warning"),
                    _("You have selected the 'default' audio device, "
                    "which may not be a valid device.  It is recommended "
                    "that you explicitly pick the audio device you "
                    "intend to use.  Use the 'default' device anyway?"),
                    QMessageBox.Yes | QMessageBox.Cancel, QMessageBox.Cancel)
                if f_warn_result == QMessageBox.Cancel:
                    return
            f_buffer_size = int(str(f_buffer_size_combobox.currentText()))
            f_samplerate = int(str(f_samplerate_combobox.currentText()))

            f_midi_in_devices = sorted(str(k)
                for k, v in self.midi_in_checkboxes.items()
                if v.isChecked())
            if len(f_midi_in_devices) >= 8:
                QMessageBox.warning(
                    f_window, _("Error"),
                    _("Using more than 8 MIDI devices is not supported, "
                    "please de-select some devices"))
                return
            f_worker_threads = f_worker_threads_combobox.currentIndex()
            if pydaw_util.IS_WINDOWS or pydaw_util.IS_MAC_OSX:
                f_audio_engine = 8
            elif pydaw_util.IS_LINUX:
                f_audio_engine = f_audio_engine_combobox.currentIndex()
                f_thread_affinity = \
                    1 if f_thread_affinity_checkbox.isChecked() else 0
                f_hugepages = 1 if f_hugepages_checkbox.isChecked() else 0
            f_audio_inputs = f_audio_in_spinbox.value()
            f_out_tuple = (f_audio_out_spinbox,) + OUT_SPINBOXES
            f_audio_outputs = "|".join(str(x.value()) for x in f_out_tuple)

            try:
                #This doesn't work if the device is open already,
                #so skip the test, and if it fails the
                #user will be prompted again next time MusiKernel starts
                if f_audio_engine != 7 or \
                not self.is_running or \
                "name" not in pydaw_util.global_device_val_dict or \
                pydaw_util.global_device_val_dict["name"] != self.device_name:
                    if (pydaw_util.IS_WINDOWS or pydaw_util.IS_MAC_OSX) \
                    and f_audio_inputs:
                        f_input = portaudio.PaStreamParameters(
                            f_name_to_index[self.subsystem][self.device_name],
                            f_audio_inputs, portaudio.paInt16,
                            float(f_buffer_size) / float(f_samplerate), None)
                        f_input_ref = ctypes.byref(f_input)
                    else:
                        f_input_ref = 0
                    f_output = portaudio.PaStreamParameters(
                        f_name_to_index[self.subsystem][self.device_name],
                        2, portaudio.paInt16,
                        float(f_buffer_size) / float(f_samplerate), None)
                    f_supported = self.pyaudio.Pa_IsFormatSupported(
                        f_input_ref, ctypes.byref(f_output), f_samplerate)
                    if not f_supported:
                        raise Exception()
                f_file = open(
                    pydaw_util.global_pydaw_device_config, "w", newline="\n")
                f_file.write("hostApi|{}\n".format(self.subsystem))
                f_file.write("name|{}\n".format(self.device_name))
                if (pydaw_util.IS_WINDOWS or pydaw_util.IS_MAC_OSX) \
                and self.input_name:
                    f_file.write("inputName|{}\n".format(self.input_name))
                f_file.write("bufferSize|{}\n".format(f_buffer_size))
                f_file.write("sampleRate|{}\n".format(f_samplerate))
                f_file.write("threads|{}\n".format(f_worker_threads))

                if pydaw_util.IS_LINUX:
                    f_file.write("audioEngine|{}\n".format(f_audio_engine))
                    f_file.write("threadAffinity|{}\n".format(
                        f_thread_affinity))
                    f_file.write("hugePages|{}\n".format(f_hugepages))
                f_file.write("audioInputs|{}\n".format(f_audio_inputs))
                f_file.write("audioOutputs|{}\n".format(f_audio_outputs))
                for f_midi_in_device in f_midi_in_devices:
                    f_file.write("midiInDevice|{}\n".format(
                        f_midi_in_device))

                f_file.write("\\")
                f_file.close()
                self.close_devices()

                self.dialog_result = True

                time.sleep(1.0)
                pydaw_util.pydaw_read_device_config()
                f_window.close()

            except Exception as ex:
                QMessageBox.warning(f_window, _("Error"),
                    _("Couldn't open audio device\n\n{}\n\n"
                    "This may (or may not) be because the "
                    "device is already open by another application or "
                    "a sound daemon such as JACK.").format(ex))
Example #59
0
def pydaw_print_generic_exception(a_ex):
    QMessageBox.warning(MAIN_WINDOW, _("Warning"),
                        _("The following error happened:\n{}").format(a_ex))