@@ -270,7 +270,6 @@ RES = \ | |||
bin/resources/carla_control.py \ | |||
bin/resources/carla_database.py \ | |||
bin/resources/carla_host.py \ | |||
bin/resources/carla_panels.py \ | |||
bin/resources/carla_settings.py \ | |||
bin/resources/carla_skin.py \ | |||
bin/resources/carla_shared.py \ | |||
@@ -295,7 +294,6 @@ RES = \ | |||
bin/resources/ui_carla_database.py \ | |||
bin/resources/ui_carla_edit.py \ | |||
bin/resources/ui_carla_host.py \ | |||
bin/resources/ui_carla_panel_time.py \ | |||
bin/resources/ui_carla_parameter.py \ | |||
bin/resources/ui_carla_plugin_calf.py \ | |||
bin/resources/ui_carla_plugin_classic.py \ | |||
@@ -340,7 +338,6 @@ UIs = \ | |||
source/ui_carla_database.py \ | |||
source/ui_carla_edit.py \ | |||
source/ui_carla_host.py \ | |||
source/ui_carla_panel_time.py \ | |||
source/ui_carla_parameter.py \ | |||
source/ui_carla_plugin_calf.py \ | |||
source/ui_carla_plugin_classic.py \ | |||
@@ -640,7 +637,6 @@ endif | |||
$(LINK) $(DATADIR)/carla/carla_database.py $(DESTDIR)$(DATADIR)/carla/resources | |||
$(LINK) $(DATADIR)/carla/carla_host.py $(DESTDIR)$(DATADIR)/carla/resources | |||
$(LINK) $(DATADIR)/carla/carla_modgui.py $(DESTDIR)$(DATADIR)/carla/resources | |||
$(LINK) $(DATADIR)/carla/carla_panels.py $(DESTDIR)$(DATADIR)/carla/resources | |||
$(LINK) $(DATADIR)/carla/carla_settings.py $(DESTDIR)$(DATADIR)/carla/resources | |||
$(LINK) $(DATADIR)/carla/carla_skin.py $(DESTDIR)$(DATADIR)/carla/resources | |||
$(LINK) $(DATADIR)/carla/carla_shared.py $(DESTDIR)$(DATADIR)/carla/resources | |||
@@ -665,7 +661,6 @@ endif | |||
$(LINK) $(DATADIR)/carla/ui_carla_database.py $(DESTDIR)$(DATADIR)/carla/resources | |||
$(LINK) $(DATADIR)/carla/ui_carla_edit.py $(DESTDIR)$(DATADIR)/carla/resources | |||
$(LINK) $(DATADIR)/carla/ui_carla_host.py $(DESTDIR)$(DATADIR)/carla/resources | |||
$(LINK) $(DATADIR)/carla/ui_carla_panel_time.py $(DESTDIR)$(DATADIR)/carla/resources | |||
$(LINK) $(DATADIR)/carla/ui_carla_parameter.py $(DESTDIR)$(DATADIR)/carla/resources | |||
$(LINK) $(DATADIR)/carla/ui_carla_plugin_calf.py $(DESTDIR)$(DATADIR)/carla/resources | |||
$(LINK) $(DATADIR)/carla/ui_carla_plugin_classic.py $(DESTDIR)$(DATADIR)/carla/resources | |||
@@ -6,8 +6,8 @@ | |||
<rect> | |||
<x>0</x> | |||
<y>0</y> | |||
<width>870</width> | |||
<height>681</height> | |||
<width>1058</width> | |||
<height>716</height> | |||
</rect> | |||
</property> | |||
<property name="windowTitle"> | |||
@@ -192,8 +192,8 @@ | |||
<rect> | |||
<x>0</x> | |||
<y>0</y> | |||
<width>870</width> | |||
<height>20</height> | |||
<width>1058</width> | |||
<height>37</height> | |||
</rect> | |||
</property> | |||
<widget class="QMenu" name="menu_File"> | |||
@@ -270,7 +270,6 @@ | |||
<property name="title"> | |||
<string>&Settings</string> | |||
</property> | |||
<addaction name="act_settings_show_time_panel"/> | |||
<addaction name="act_settings_show_toolbar"/> | |||
<addaction name="act_settings_show_meters"/> | |||
<addaction name="act_settings_show_keyboard"/> | |||
@@ -456,6 +455,217 @@ | |||
</item> | |||
</layout> | |||
</widget> | |||
<widget class="QWidget" name="w_transport"> | |||
<attribute name="title"> | |||
<string>Transport</string> | |||
</attribute> | |||
<layout class="QVBoxLayout" name="verticalLayout_6"> | |||
<item> | |||
<widget class="QGroupBox" name="group_transport_controls"> | |||
<property name="title"> | |||
<string>Playback Controls</string> | |||
</property> | |||
<layout class="QHBoxLayout" name="horizontalLayout_5"> | |||
<item> | |||
<widget class="QPushButton" name="b_transport_play"> | |||
<property name="text"> | |||
<string/> | |||
</property> | |||
<property name="icon"> | |||
<iconset resource="../resources.qrc"> | |||
<normaloff>:/16x16/media-playback-start.png</normaloff>:/16x16/media-playback-start.png</iconset> | |||
</property> | |||
<property name="checkable"> | |||
<bool>true</bool> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QPushButton" name="b_transport_stop"> | |||
<property name="text"> | |||
<string/> | |||
</property> | |||
<property name="icon"> | |||
<iconset resource="../resources.qrc"> | |||
<normaloff>:/16x16/media-playback-stop.png</normaloff>:/16x16/media-playback-stop.png</iconset> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QPushButton" name="b_transport_backwards"> | |||
<property name="text"> | |||
<string/> | |||
</property> | |||
<property name="icon"> | |||
<iconset resource="../resources.qrc"> | |||
<normaloff>:/16x16/media-seek-backward.png</normaloff>:/16x16/media-seek-backward.png</iconset> | |||
</property> | |||
<property name="autoRepeat"> | |||
<bool>true</bool> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QPushButton" name="b_transport_forwards"> | |||
<property name="text"> | |||
<string/> | |||
</property> | |||
<property name="icon"> | |||
<iconset resource="../resources.qrc"> | |||
<normaloff>:/16x16/media-seek-forward.png</normaloff>:/16x16/media-seek-forward.png</iconset> | |||
</property> | |||
<property name="autoRepeat"> | |||
<bool>true</bool> | |||
</property> | |||
</widget> | |||
</item> | |||
</layout> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QGroupBox" name="group_transport_info"> | |||
<property name="title"> | |||
<string>Time Information</string> | |||
</property> | |||
<layout class="QVBoxLayout" name="verticalLayout_2"> | |||
<item> | |||
<layout class="QHBoxLayout" name="horizontalLayout_6"> | |||
<item> | |||
<widget class="QLabel" name="label_transport_frame"> | |||
<property name="text"> | |||
<string>Frame:</string> | |||
</property> | |||
<property name="alignment"> | |||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QLabel" name="l_transport_frame"> | |||
<property name="font"> | |||
<font> | |||
<family>DejaVu Sans Mono</family> | |||
</font> | |||
</property> | |||
<property name="text"> | |||
<string>00000000</string> | |||
</property> | |||
</widget> | |||
</item> | |||
</layout> | |||
</item> | |||
<item> | |||
<layout class="QHBoxLayout" name="horizontalLayout_7"> | |||
<item> | |||
<widget class="QLabel" name="label_transport_time"> | |||
<property name="text"> | |||
<string>Time:</string> | |||
</property> | |||
<property name="alignment"> | |||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QLabel" name="l_transport_time"> | |||
<property name="font"> | |||
<font> | |||
<family>DejaVu Sans Mono</family> | |||
</font> | |||
</property> | |||
<property name="text"> | |||
<string>00:00:00</string> | |||
</property> | |||
</widget> | |||
</item> | |||
</layout> | |||
</item> | |||
<item> | |||
<layout class="QHBoxLayout" name="horizontalLayout_8"> | |||
<item> | |||
<widget class="QLabel" name="label_transport_bbt"> | |||
<property name="text"> | |||
<string>BBT:</string> | |||
</property> | |||
<property name="alignment"> | |||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QLabel" name="l_transport_bbt"> | |||
<property name="font"> | |||
<font> | |||
<family>DejaVu Sans Mono</family> | |||
</font> | |||
</property> | |||
<property name="text"> | |||
<string>000|0|000</string> | |||
</property> | |||
</widget> | |||
</item> | |||
</layout> | |||
</item> | |||
</layout> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QGroupBox" name="group_transport_settings"> | |||
<property name="title"> | |||
<string>Settings</string> | |||
</property> | |||
<layout class="QVBoxLayout" name="verticalLayout_5"> | |||
<item> | |||
<widget class="QDoubleSpinBox" name="dsb_transport_bpm"> | |||
<property name="enabled"> | |||
<bool>false</bool> | |||
</property> | |||
<property name="suffix"> | |||
<string> BPM</string> | |||
</property> | |||
<property name="decimals"> | |||
<number>1</number> | |||
</property> | |||
<property name="minimum"> | |||
<double>20.000000000000000</double> | |||
</property> | |||
<property name="maximum"> | |||
<double>999.000000000000000</double> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QCheckBox" name="cb_transport_jack"> | |||
<property name="text"> | |||
<string>Use JACK Transport</string> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QCheckBox" name="cb_transport_link"> | |||
<property name="text"> | |||
<string>Use Ableton Link</string> | |||
</property> | |||
</widget> | |||
</item> | |||
</layout> | |||
</widget> | |||
</item> | |||
<item> | |||
<spacer name="verticalSpacer"> | |||
<property name="orientation"> | |||
<enum>Qt::Vertical</enum> | |||
</property> | |||
<property name="sizeHint" stdset="0"> | |||
<size> | |||
<width>20</width> | |||
<height>40</height> | |||
</size> | |||
</property> | |||
</spacer> | |||
</item> | |||
</layout> | |||
</widget> | |||
</widget> | |||
</item> | |||
<item> | |||
@@ -41,7 +41,6 @@ import ui_carla_host | |||
from carla_app import * | |||
from carla_database import * | |||
from carla_panels import * | |||
from carla_settings import * | |||
from carla_utils import * | |||
from carla_widgets import * | |||
@@ -124,6 +123,11 @@ class HostWindow(QMainWindow): | |||
self.fIsProjectLoading = False | |||
self.fCurrentlyRemovingAllPlugins = False | |||
self.fLastTransportBPM = 0.0 | |||
self.fLastTransportFrame = 0 | |||
self.fLastTransportState = False | |||
self.fSampleRate = 0.0 | |||
# run a custom action after engine is properly closed | |||
# 1 for close carla, 2 for load project | |||
self.fCustomStopAction = 0 | |||
@@ -175,8 +179,6 @@ class HostWindow(QMainWindow): | |||
self.ui.act_engine_start.setVisible(False) | |||
self.ui.act_engine_stop.setEnabled(False) | |||
self.ui.act_engine_stop.setVisible(False) | |||
self.ui.act_settings_show_time_panel.setEnabled(False) | |||
self.ui.act_settings_show_time_panel.setVisible(False) | |||
self.ui.menu_Engine.setEnabled(False) | |||
self.ui.menu_Engine.setVisible(False) | |||
self.ui.menu_Engine.menuAction().setVisible(False) | |||
@@ -268,11 +270,21 @@ class HostWindow(QMainWindow): | |||
self.ui.fileTreeView.setHeaderHidden(True) | |||
# ---------------------------------------------------------------------------------------------------- | |||
# Set up GUI (panels) | |||
# Set up GUI (transport) | |||
self.ui.l_transport_bbt.setMinimumWidth(QFontMetrics(self.ui.l_transport_bbt.font()).width("000|00|0000") + 3) | |||
self.ui.l_transport_frame.setMinimumWidth(QFontMetrics(self.ui.l_transport_frame.font()).width("000'000'000") + 3) | |||
self.ui.l_transport_time.setMinimumWidth(QFontMetrics(self.ui.l_transport_time.font()).width("00:00:00") + 3) | |||
self.ui.panelTime = CarlaPanelTime(host, self) | |||
self.ui.panelTime.setEnabled(False) | |||
self.ui.panelTime.adjustSize() | |||
if host.isPlugin: | |||
self.ui.b_transport_play.setEnabled(False) | |||
self.ui.b_transport_stop.setEnabled(False) | |||
self.ui.b_transport_backwards.setEnabled(False) | |||
self.ui.b_transport_forwards.setEnabled(False) | |||
self.ui.cb_transport_link.setEnabled(False) | |||
self.ui.dsb_transport_bpm.setEnabled(False) | |||
self.ui.w_transport.setEnabled(False) | |||
# ---------------------------------------------------------------------------------------------------- | |||
# Set up GUI (rack) | |||
@@ -392,7 +404,6 @@ class HostWindow(QMainWindow): | |||
self.ui.act_canvas_save_image.triggered.connect(self.slot_canvasSaveImage) | |||
self.ui.act_canvas_arrange.setEnabled(False) # TODO, later | |||
self.ui.act_settings_show_time_panel.toggled.connect(self.slot_showTimePanel) | |||
self.ui.act_settings_show_toolbar.toggled.connect(self.slot_showToolbar) | |||
self.ui.act_settings_show_meters.toggled.connect(self.slot_showCanvasMeters) | |||
self.ui.act_settings_show_keyboard.toggled.connect(self.slot_showCanvasKeyboard) | |||
@@ -408,6 +419,13 @@ class HostWindow(QMainWindow): | |||
self.ui.b_disk_remove.clicked.connect(self.slot_diskFolderRemove) | |||
self.ui.fileTreeView.doubleClicked.connect(self.slot_fileTreeDoubleClicked) | |||
self.ui.b_transport_play.clicked.connect(self.slot_transportPlayPause) | |||
self.ui.b_transport_stop.clicked.connect(self.slot_transportStop) | |||
self.ui.b_transport_backwards.clicked.connect(self.slot_transportBackwards) | |||
self.ui.b_transport_forwards.clicked.connect(self.slot_transportForwards) | |||
self.ui.cb_transport_jack.clicked.connect(self.slot_transportJackEnabled) | |||
self.ui.cb_transport_link.clicked.connect(self.slot_transportLinkEnabled) | |||
self.ui.listWidget.customContextMenuRequested.connect(self.showPluginActionsMenu) | |||
self.ui.graphicsView.horizontalScrollBar().valueChanged.connect(self.slot_horizontalScrollBarChanged) | |||
@@ -418,7 +436,6 @@ class HostWindow(QMainWindow): | |||
self.ui.miniCanvasPreview.miniCanvasMoved.connect(self.slot_miniCanvasMoved) | |||
self.ui.panelTime.finished.connect(self.slot_timePanelClosed) | |||
self.ui.tabWidget.currentChanged.connect(self.slot_tabChanged) | |||
self.scene.scaleChanged.connect(self.slot_canvasScaleChanged) | |||
@@ -430,6 +447,7 @@ class HostWindow(QMainWindow): | |||
host.EngineStartedCallback.connect(self.slot_handleEngineStartedCallback) | |||
host.EngineStoppedCallback.connect(self.slot_handleEngineStoppedCallback) | |||
host.SampleRateChangedCallback.connect(self.slot_handleSampleRateChangedCallback) | |||
host.PluginAddedCallback.connect(self.slot_handlePluginAddedCallback) | |||
host.PluginRemovedCallback.connect(self.slot_handlePluginRemovedCallback) | |||
@@ -701,6 +719,8 @@ class HostWindow(QMainWindow): | |||
@pyqtSlot(int, int, str) | |||
def slot_handleEngineStartedCallback(self, processMode, transportMode, driverName): | |||
self.fSampleRate = self.host.get_sample_rate() | |||
self.ui.menu_PluginMacros.setEnabled(True) | |||
self.ui.menu_Canvas.setEnabled(True) | |||
@@ -726,12 +746,17 @@ class HostWindow(QMainWindow): | |||
self.ui.act_file_save.setEnabled(canSave) | |||
self.ui.act_engine_start.setEnabled(False) | |||
self.ui.act_engine_stop.setEnabled(True) | |||
self.ui.panelTime.setEnabled(True) | |||
self.ui.w_transport.setEnabled(True) | |||
if self.host.isPlugin or not self.fSessionManagerName: | |||
self.ui.act_file_open.setEnabled(True) | |||
self.ui.act_file_save_as.setEnabled(True) | |||
self.refreshTransport(True) | |||
self.ui.cb_transport_jack.setChecked(transportMode == ENGINE_TRANSPORT_MODE_JACK) | |||
self.ui.cb_transport_jack.setEnabled(driverName == "JACK") | |||
self.startTimers() | |||
@pyqtSlot() | |||
@@ -749,12 +774,17 @@ class HostWindow(QMainWindow): | |||
self.ui.act_file_save.setEnabled(False) | |||
self.ui.act_engine_start.setEnabled(True) | |||
self.ui.act_engine_stop.setEnabled(False) | |||
self.ui.panelTime.setEnabled(False) | |||
self.ui.w_transport.setEnabled(False) | |||
if self.host.isPlugin or not self.fSessionManagerName: | |||
self.ui.act_file_open.setEnabled(False) | |||
self.ui.act_file_save_as.setEnabled(False) | |||
@pyqtSlot(float) | |||
def slot_handleSampleRateChangedCallback(self, newSampleRate): | |||
self.fSampleRate = newSampleRate | |||
self.refreshTransport(True) | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Plugins | |||
@@ -1308,13 +1338,9 @@ class HostWindow(QMainWindow): | |||
settings = QSettings() | |||
settings.setValue("Geometry", self.saveGeometry()) | |||
settings.setValue("TimePanelGeometry", self.ui.panelTime.saveGeometry()) | |||
#settings.setValue("SplitterState", self.ui.splitter.saveState()) | |||
if not (self.host.isControl or self.host.isPlugin): | |||
settings.setValue("ShowTimePanel", self.ui.panelTime.isVisible()) | |||
settings.setValue("ShowToolbar", self.ui.toolBar.isEnabled()) | |||
settings.setValue("ShowSidePanel", self.ui.dockWidget.isEnabled()) | |||
@@ -1337,17 +1363,6 @@ class HostWindow(QMainWindow): | |||
if firstTime: | |||
self.restoreGeometry(settings.value("Geometry", b"")) | |||
if not (self.host.isControl or self.host.isPlugin): | |||
self.ui.panelTime.restoreGeometry(settings.value("TimePanelGeometry", b"")) | |||
showTimePanel = settings.value("ShowTimePanel", True, type=bool) | |||
self.ui.act_settings_show_time_panel.setChecked(showTimePanel) | |||
if showTimePanel: | |||
QTimer.singleShot(0, self.ui.panelTime.show) | |||
else: | |||
self.ui.panelTime.hide() | |||
showToolbar = settings.value("ShowToolbar", True, type=bool) | |||
self.ui.act_settings_show_toolbar.setChecked(showToolbar) | |||
self.ui.toolBar.setEnabled(showToolbar) | |||
@@ -1422,10 +1437,6 @@ class HostWindow(QMainWindow): | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Settings (menu actions) | |||
@pyqtSlot(bool) | |||
def slot_showTimePanel(self, yesNo): | |||
self.ui.panelTime.setVisible(yesNo) | |||
@pyqtSlot(bool) | |||
def slot_showSidePanel(self, yesNo): | |||
self.ui.dockWidget.setEnabled(yesNo) | |||
@@ -1535,6 +1546,123 @@ class HostWindow(QMainWindow): | |||
self.tr("Failed to load file"), | |||
self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok) | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Transport | |||
def refreshTransport(self, forced = False): | |||
if not self.isVisible(): | |||
return | |||
if self.fSampleRate == 0.0 or not self.host.is_engine_running(): | |||
return | |||
timeInfo = self.host.get_transport_info() | |||
playing = timeInfo['playing'] | |||
frame = timeInfo['frame'] | |||
bpm = timeInfo['bpm'] | |||
if playing != self.fLastTransportState or forced: | |||
if playing: | |||
icon = getIcon("media-playback-pause") | |||
self.ui.b_transport_play.setChecked(True) | |||
self.ui.b_transport_play.setIcon(icon) | |||
#self.ui.b_transport_play.setText(self.tr("&Pause")) | |||
else: | |||
icon = getIcon("media-playback-start") | |||
self.ui.b_transport_play.setChecked(False) | |||
self.ui.b_transport_play.setIcon(icon) | |||
#self.ui.b_play.setText(self.tr("&Play")) | |||
self.fLastTransportState = playing | |||
if frame != self.fLastTransportFrame or forced: | |||
self.fLastTransportFrame = frame | |||
time = frame / self.fSampleRate | |||
secs = time % 60 | |||
mins = (time / 60) % 60 | |||
hrs = (time / 3600) % 60 | |||
self.ui.l_transport_time.setText("%02i:%02i:%02i" % (hrs, mins, secs)) | |||
frame1 = frame % 1000 | |||
frame2 = (frame / 1000) % 1000 | |||
frame3 = (frame / 1000000) % 1000 | |||
self.ui.l_transport_frame.setText("%03i'%03i'%03i" % (frame3, frame2, frame1)) | |||
bar = timeInfo['bar'] | |||
beat = timeInfo['beat'] | |||
tick = timeInfo['tick'] | |||
self.ui.l_transport_bbt.setText("%03i|%02i|%04i" % (bar, beat, tick)) | |||
if bpm != self.fLastTransportBPM or forced: | |||
self.fLastTransportBPM = bpm | |||
if bpm > 0.0: | |||
self.ui.dsb_transport_bpm.setValue(bpm) | |||
self.ui.dsb_transport_bpm.setStyleSheet("") | |||
else: | |||
self.ui.dsb_transport_bpm.setStyleSheet("QDoubleSpinBox { color: palette(mid); }") | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Transport (menu actions) | |||
@pyqtSlot(bool) | |||
def slot_transportPlayPause(self, toggled): | |||
if self.host.isPlugin or not self.host.is_engine_running(): | |||
return | |||
if toggled: | |||
self.host.transport_play() | |||
else: | |||
self.host.transport_pause() | |||
self.refreshTransport() | |||
@pyqtSlot() | |||
def slot_transportStop(self): | |||
if self.host.isPlugin or not self.host.is_engine_running(): | |||
return | |||
self.host.transport_pause() | |||
self.host.transport_relocate(0) | |||
self.refreshTransport() | |||
@pyqtSlot() | |||
def slot_transportBackwards(self): | |||
if self.host.isPlugin or not self.host.is_engine_running(): | |||
return | |||
newFrame = self.host.get_current_transport_frame() - 100000 | |||
if newFrame < 0: | |||
newFrame = 0 | |||
self.host.transport_relocate(newFrame) | |||
@pyqtSlot() | |||
def slot_transportForwards(self): | |||
if self.fSampleRate == 0.0 or self.host.isPlugin or not self.host.is_engine_running(): | |||
return | |||
newFrame = self.host.get_current_transport_frame() + int(self.fSampleRate*2.5) | |||
self.host.transport_relocate(newFrame) | |||
@pyqtSlot(bool) | |||
def slot_transportJackEnabled(self, clicked): | |||
if not self.host.is_engine_running(): | |||
return | |||
mode = ENGINE_TRANSPORT_MODE_JACK if clicked else ENGINE_TRANSPORT_MODE_INTERNAL | |||
extra = ":link:" if self.ui.cb_transport_link.isChecked() else "" | |||
self.host.set_engine_option(ENGINE_OPTION_TRANSPORT_MODE, mode, extra) | |||
@pyqtSlot(bool) | |||
def slot_transportLinkEnabled(self, clicked): | |||
if not self.host.is_engine_running(): | |||
return | |||
mode = ENGINE_TRANSPORT_MODE_JACK if self.ui.cb_transport_jack.isChecked() else ENGINE_TRANSPORT_MODE_INTERNAL | |||
extra = ":link:" if clicked else "" | |||
self.host.set_engine_option(ENGINE_OPTION_TRANSPORT_MODE, mode, extra) | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Canvas scrollbars | |||
@@ -1684,10 +1812,6 @@ class HostWindow(QMainWindow): | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Misc | |||
@pyqtSlot() | |||
def slot_timePanelClosed(self): | |||
self.ui.act_settings_show_time_panel.setChecked(False) | |||
@pyqtSlot(int) | |||
def slot_tabChanged(self, index): | |||
if index != 1: | |||
@@ -1873,6 +1997,7 @@ class HostWindow(QMainWindow): | |||
# show/hide event | |||
def showEvent(self, event): | |||
self.refreshTransport(True) | |||
QMainWindow.showEvent(self, event) | |||
# set our gui as parent for all plugins UIs | |||
@@ -1908,7 +2033,7 @@ class HostWindow(QMainWindow): | |||
def idleFast(self): | |||
self.host.engine_idle() | |||
self.ui.panelTime.refreshTransport() | |||
self.refreshTransport() | |||
if self.fPluginCount == 0 or self.fCurrentlyRemovingAllPlugins: | |||
return | |||
@@ -1,227 +0,0 @@ | |||
#!/usr/bin/env python3 | |||
# -*- coding: utf-8 -*- | |||
# Carla host code | |||
# Copyright (C) 2011-2017 Filipe Coelho <falktx@falktx.com> | |||
# | |||
# This program is free software; you can redistribute it and/or | |||
# modify it under the terms of the GNU General Public License as | |||
# published by the Free Software Foundation; either version 2 of | |||
# the License, or any later version. | |||
# | |||
# 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. | |||
# | |||
# For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# Imports (Config) | |||
from carla_config import * | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# Imports (Global) | |||
if config_UseQt5: | |||
from PyQt5.QtCore import pyqtSlot | |||
from PyQt5.QtGui import QFontMetrics | |||
from PyQt5.QtWidgets import QDialog | |||
else: | |||
from PyQt4.QtCore import pyqtSlot | |||
from PyQt4.QtGui import QDialog, QFontMetrics | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# Imports (Custom) | |||
from carla_shared import * | |||
import ui_carla_panel_time | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# Time Panel | |||
class CarlaPanelTime(QDialog): | |||
def __init__(self, host, parent): | |||
QDialog.__init__(self, parent) | |||
self.host = host | |||
self.ui = ui_carla_panel_time.Ui_Dialog() | |||
self.ui.setupUi(self) | |||
if False: | |||
# kdevelop likes this :) | |||
host = CarlaHostNull() | |||
self.host = host | |||
# ---------------------------------------------------------------------------------------------------- | |||
# Internal stuff | |||
self.fLastTransportBPM = 0.0 | |||
self.fLastTransportFrame = 0 | |||
self.fLastTransportState = False | |||
self.fSampleRate = 0.0 | |||
self.ui.l_time_frame.setMinimumWidth(QFontMetrics(self.ui.l_time_frame.font()).width("000'000'000") + 3) | |||
self.ui.l_time_clock.setMinimumWidth(QFontMetrics(self.ui.l_time_clock.font()).width("00:00:00") + 3) | |||
self.ui.l_time_bbt.setMinimumWidth(QFontMetrics(self.ui.l_time_bbt.font()).width("000|00|0000") + 3) | |||
# ---------------------------------------------------------------------------------------------------- | |||
# Disable buttons if plugin | |||
if host.isPlugin: | |||
self.ui.b_play.setEnabled(False) | |||
self.ui.b_stop.setEnabled(False) | |||
self.ui.b_backwards.setEnabled(False) | |||
self.ui.b_forwards.setEnabled(False) | |||
self.ui.cb_transport_link.setEnabled(False) | |||
self.ui.dsb_bpm.setEnabled(False) | |||
# ---------------------------------------------------------------------------------------------------- | |||
# Connect actions to functions | |||
self.ui.b_play.clicked.connect(self.slot_transportPlayPause) | |||
self.ui.b_stop.clicked.connect(self.slot_transportStop) | |||
self.ui.b_backwards.clicked.connect(self.slot_transportBackwards) | |||
self.ui.b_forwards.clicked.connect(self.slot_transportForwards) | |||
self.ui.cb_transport_jack.clicked.connect(self.slot_transportJackEnabled) | |||
self.ui.cb_transport_link.clicked.connect(self.slot_transportLinkEnabled) | |||
host.EngineStartedCallback.connect(self.slot_handleEngineStartedCallback) | |||
host.SampleRateChangedCallback.connect(self.slot_handleSampleRateChangedCallback) | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Button actions | |||
@pyqtSlot(bool) | |||
def slot_transportPlayPause(self, toggled): | |||
if self.host.isPlugin or not self.host.is_engine_running(): | |||
return | |||
if toggled: | |||
self.host.transport_play() | |||
else: | |||
self.host.transport_pause() | |||
self.refreshTransport() | |||
@pyqtSlot() | |||
def slot_transportStop(self): | |||
if self.host.isPlugin or not self.host.is_engine_running(): | |||
return | |||
self.host.transport_pause() | |||
self.host.transport_relocate(0) | |||
self.refreshTransport() | |||
@pyqtSlot() | |||
def slot_transportBackwards(self): | |||
if self.host.isPlugin or not self.host.is_engine_running(): | |||
return | |||
newFrame = self.host.get_current_transport_frame() - 100000 | |||
if newFrame < 0: | |||
newFrame = 0 | |||
self.host.transport_relocate(newFrame) | |||
@pyqtSlot() | |||
def slot_transportForwards(self): | |||
if self.fSampleRate == 0.0 or self.host.isPlugin or not self.host.is_engine_running(): | |||
return | |||
newFrame = self.host.get_current_transport_frame() + int(self.fSampleRate*2.5) | |||
self.host.transport_relocate(newFrame) | |||
@pyqtSlot(bool) | |||
def slot_transportJackEnabled(self, clicked): | |||
if not self.host.is_engine_running(): | |||
return | |||
mode = ENGINE_TRANSPORT_MODE_JACK if clicked else ENGINE_TRANSPORT_MODE_INTERNAL | |||
extra = ":link:" if self.ui.cb_transport_link.isChecked() else "" | |||
self.host.set_engine_option(ENGINE_OPTION_TRANSPORT_MODE, mode, extra) | |||
@pyqtSlot(bool) | |||
def slot_transportLinkEnabled(self, clicked): | |||
if not self.host.is_engine_running(): | |||
return | |||
mode = ENGINE_TRANSPORT_MODE_JACK if self.ui.cb_transport_jack.isChecked() else ENGINE_TRANSPORT_MODE_INTERNAL | |||
extra = ":link:" if clicked else "" | |||
self.host.set_engine_option(ENGINE_OPTION_TRANSPORT_MODE, mode, extra) | |||
def showEvent(self, event): | |||
self.refreshTransport(True) | |||
QDialog.showEvent(self, event) | |||
def refreshTransport(self, forced = False): | |||
if not self.isVisible(): | |||
return | |||
if self.fSampleRate == 0.0 or not self.host.is_engine_running(): | |||
return | |||
timeInfo = self.host.get_transport_info() | |||
playing = timeInfo['playing'] | |||
frame = timeInfo['frame'] | |||
bpm = timeInfo['bpm'] | |||
if playing != self.fLastTransportState or forced: | |||
if playing: | |||
icon = getIcon("media-playback-pause") | |||
self.ui.b_play.setChecked(True) | |||
self.ui.b_play.setIcon(icon) | |||
#self.ui.b_play.setText(self.tr("&Pause")) | |||
else: | |||
icon = getIcon("media-playback-start") | |||
self.ui.b_play.setChecked(False) | |||
self.ui.b_play.setIcon(icon) | |||
#self.ui.b_play.setText(self.tr("&Play")) | |||
self.fLastTransportState = playing | |||
if frame != self.fLastTransportFrame or forced: | |||
self.fLastTransportFrame = frame | |||
time = frame / self.fSampleRate | |||
secs = time % 60 | |||
mins = (time / 60) % 60 | |||
hrs = (time / 3600) % 60 | |||
self.ui.l_time_clock.setText("%02i:%02i:%02i" % (hrs, mins, secs)) | |||
frame1 = frame % 1000 | |||
frame2 = (frame / 1000) % 1000 | |||
frame3 = (frame / 1000000) % 1000 | |||
self.ui.l_time_frame.setText("%03i'%03i'%03i" % (frame3, frame2, frame1)) | |||
bar = timeInfo['bar'] | |||
beat = timeInfo['beat'] | |||
tick = timeInfo['tick'] | |||
self.ui.l_time_bbt.setText("%03i|%02i|%04i" % (bar, beat, tick)) | |||
if bpm != self.fLastTransportBPM or forced: | |||
self.fLastTransportBPM = bpm | |||
if bpm > 0.0: | |||
self.ui.dsb_bpm.setValue(bpm) | |||
self.ui.dsb_bpm.setStyleSheet("") | |||
else: | |||
self.ui.dsb_bpm.setStyleSheet("QDoubleSpinBox { color: palette(mid); }") | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Engine callbacks | |||
@pyqtSlot(int, int, str) | |||
def slot_handleEngineStartedCallback(self, processMode, transportMode, driverName): | |||
self.fSampleRate = self.host.get_sample_rate() | |||
self.refreshTransport(True) | |||
self.ui.cb_transport_jack.setEnabled(driverName == "JACK") | |||
self.ui.cb_transport_jack.setChecked(transportMode == ENGINE_TRANSPORT_MODE_JACK) | |||
@pyqtSlot(float) | |||
def slot_handleSampleRateChangedCallback(self, newSampleRate): | |||
self.fSampleRate = newSampleRate | |||
self.refreshTransport(True) | |||
# ------------------------------------------------------------------------------------------------------------ |