@@ -284,6 +284,7 @@ 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_basic_fx.py \ | |||
bin/resources/ui_carla_plugin_calf.py \ | |||
@@ -325,6 +326,7 @@ UIs = \ | |||
source/ui_carla_edit.py \ | |||
source/ui_carla_host.py \ | |||
source/ui_carla_parameter.py \ | |||
source/ui_carla_panel_time.py \ | |||
source/ui_carla_plugin_basic_fx.py \ | |||
source/ui_carla_plugin_calf.py \ | |||
source/ui_carla_plugin_default.py \ | |||
@@ -34,9 +34,18 @@ | |||
<property name="spacing"> | |||
<number>0</number> | |||
</property> | |||
<property name="margin"> | |||
<property name="leftMargin"> | |||
<number>0</number> | |||
</property> | |||
<property name="topMargin"> | |||
<number>0</number> | |||
</property> | |||
<property name="rightMargin"> | |||
<number>0</number> | |||
</property> | |||
<property name="bottomMargin"> | |||
<number>1</number> | |||
</property> | |||
<item> | |||
<widget class="QLabel" name="pad_left"> | |||
<property name="minimumSize"> | |||
@@ -173,15 +182,6 @@ | |||
<addaction name="separator"/> | |||
<addaction name="menu_PluginMacros"/> | |||
</widget> | |||
<widget class="QMenu" name="menu_Transport"> | |||
<property name="title"> | |||
<string>&Transport</string> | |||
</property> | |||
<addaction name="act_transport_play"/> | |||
<addaction name="act_transport_stop"/> | |||
<addaction name="act_transport_backwards"/> | |||
<addaction name="act_transport_forwards"/> | |||
</widget> | |||
<widget class="QMenu" name="menu_Canvas"> | |||
<property name="title"> | |||
<string>&Canvas</string> | |||
@@ -227,7 +227,6 @@ | |||
<addaction name="menu_File"/> | |||
<addaction name="menu_Engine"/> | |||
<addaction name="menu_Plugin"/> | |||
<addaction name="menu_Transport"/> | |||
<addaction name="menu_Canvas"/> | |||
<addaction name="menu_Settings"/> | |||
<addaction name="menu_Help"/> | |||
@@ -0,0 +1,92 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<ui version="4.0"> | |||
<class>Dialog</class> | |||
<widget class="QDialog" name="Dialog"> | |||
<property name="geometry"> | |||
<rect> | |||
<x>0</x> | |||
<y>0</y> | |||
<width>400</width> | |||
<height>133</height> | |||
</rect> | |||
</property> | |||
<property name="windowTitle"> | |||
<string>Time Panel</string> | |||
</property> | |||
<layout class="QVBoxLayout" name="verticalLayout"> | |||
<item> | |||
<layout class="QHBoxLayout" name="horizontalLayout"> | |||
<item> | |||
<widget class="QPushButton" name="b_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_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_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_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> | |||
</item> | |||
<item> | |||
<widget class="QLabel" name="l_time"> | |||
<property name="font"> | |||
<font> | |||
<family>DejaVu Sans Mono</family> | |||
</font> | |||
</property> | |||
<property name="text"> | |||
<string>00:00:00</string> | |||
</property> | |||
</widget> | |||
</item> | |||
</layout> | |||
</widget> | |||
<resources> | |||
<include location="../resources.qrc"/> | |||
</resources> | |||
<connections/> | |||
</ui> |
@@ -41,6 +41,7 @@ import ui_carla_host | |||
from carla_app import * | |||
from carla_database import * | |||
from carla_panels import * | |||
from carla_settings import * | |||
from carla_widgets import * | |||
from digitalpeakmeter import DigitalPeakMeter | |||
@@ -145,14 +146,6 @@ class HostWindow(QMainWindow, PluginEditParentMeta): | |||
self.fWithCanvas = withCanvas | |||
# ---------------------------------------------------------------------------------------------------- | |||
# Internal stuff (transport, TODO remove) | |||
self.fSampleRate = 0.0 | |||
self.fLastTransportFrame = 0 | |||
self.fLastTransportState = False | |||
self.fTransportText = "" | |||
# ---------------------------------------------------------------------------------------------------- | |||
# Set up GUI (engine stopped) | |||
@@ -180,8 +173,6 @@ class HostWindow(QMainWindow, PluginEditParentMeta): | |||
self.ui.dockWidgetTitleBar = QWidget(self) | |||
self.ui.dockWidget.setTitleBarWidget(self.ui.dockWidgetTitleBar) | |||
self.setTransportMenuEnabled(False) | |||
if not withCanvas: | |||
self.ui.act_canvas_show_internal.setVisible(False) | |||
self.ui.act_canvas_show_external.setVisible(False) | |||
@@ -219,6 +210,13 @@ class HostWindow(QMainWindow, PluginEditParentMeta): | |||
self.ui.fileTreeView.setColumnHidden(3, True) | |||
self.ui.fileTreeView.setHeaderHidden(True) | |||
# ---------------------------------------------------------------------------------------------------- | |||
# Set up GUI (panels) | |||
self.fPanelTime = CarlaPanelTime(host, self) | |||
self.fPanelTime.setEnabled(False) | |||
self.fPanelTime.show() | |||
# ---------------------------------------------------------------------------------------------------- | |||
# Set up GUI (rack) | |||
@@ -338,11 +336,6 @@ class HostWindow(QMainWindow, PluginEditParentMeta): | |||
self.ui.act_canvas_save_image.triggered.connect(self.slot_canvasSaveImage) | |||
self.ui.act_canvas_arrange.setEnabled(False) # TODO, later | |||
self.ui.act_transport_play.triggered.connect(self.slot_transportPlayPause) | |||
self.ui.act_transport_stop.triggered.connect(self.slot_transportStop) | |||
self.ui.act_transport_backwards.triggered.connect(self.slot_transportBackwards) | |||
self.ui.act_transport_forwards.triggered.connect(self.slot_transportForwards) | |||
self.ui.act_settings_show_meters.toggled.connect(self.slot_showCanvasMeters) | |||
self.ui.act_settings_show_keyboard.toggled.connect(self.slot_showCanvasKeyboard) | |||
self.ui.act_settings_configure.triggered.connect(self.slot_configureCarla) | |||
@@ -373,7 +366,6 @@ class HostWindow(QMainWindow, PluginEditParentMeta): | |||
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) | |||
@@ -412,37 +404,6 @@ class HostWindow(QMainWindow, PluginEditParentMeta): | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Setup | |||
def refreshTransport(self, forced = False): | |||
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'] | |||
if playing != self.fLastTransportState or forced: | |||
if playing: | |||
icon = getIcon("media-playback-pause") | |||
self.ui.act_transport_play.setChecked(True) | |||
self.ui.act_transport_play.setIcon(icon) | |||
self.ui.act_transport_play.setText(self.tr("&Pause")) | |||
else: | |||
icon = getIcon("media-playback-start") | |||
self.ui.act_transport_play.setChecked(False) | |||
self.ui.act_transport_play.setIcon(icon) | |||
self.ui.act_transport_play.setText(self.tr("&Play")) | |||
self.fLastTransportState = playing | |||
if frame != self.fLastTransportFrame or forced: | |||
time = frame / self.fSampleRate | |||
secs = time % 60 | |||
mins = (time / 60) % 60 | |||
hrs = (time / 3600) % 60 | |||
self.fTransportText = "Transport %s, at %02i:%02i:%02i" % ("playing" if playing else "stopped", hrs, mins, secs) | |||
self.fLastTransportFrame = frame | |||
def setLoadRDFsNeeded(self): | |||
self.fLadspaRdfNeedsUpdate = True | |||
@@ -597,8 +558,6 @@ class HostWindow(QMainWindow, PluginEditParentMeta): | |||
@pyqtSlot(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) | |||
@@ -611,11 +570,9 @@ class HostWindow(QMainWindow, PluginEditParentMeta): | |||
self.ui.act_file_save.setEnabled(True) | |||
self.ui.act_file_save_as.setEnabled(True) | |||
self.setTransportMenuEnabled(True) | |||
self.fPanelTime.setEnabled(True) | |||
self.fLastTransportFrame = 0 | |||
self.fLastTransportState = False | |||
self.refreshTransport(True) | |||
self.fPanelTime.refreshTransport(True) | |||
self.startTimers() | |||
@pyqtSlot() | |||
@@ -638,10 +595,7 @@ class HostWindow(QMainWindow, PluginEditParentMeta): | |||
self.ui.act_file_save.setEnabled(False) | |||
self.ui.act_file_save_as.setEnabled(False) | |||
self.setTransportMenuEnabled(False) | |||
self.fSampleRate = 0.0 | |||
self.fTransportText = "" | |||
self.fPanelTime.setEnabled(False) | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Plugins | |||
@@ -1128,61 +1082,6 @@ class HostWindow(QMainWindow, PluginEditParentMeta): | |||
patchcanvas.disconnectPorts(connectionId) | |||
QTimer.singleShot(0, self.ui.miniCanvasPreview.update) | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Transport | |||
def setTransportMenuEnabled(self, enabled): | |||
self.ui.act_transport_play.setEnabled(enabled) | |||
self.ui.act_transport_stop.setEnabled(enabled) | |||
self.ui.act_transport_backwards.setEnabled(enabled) | |||
self.ui.act_transport_forwards.setEnabled(enabled) | |||
self.ui.menu_Transport.setEnabled(enabled) | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Transport (menu actions) | |||
@pyqtSlot(bool) | |||
def slot_transportPlayPause(self, toggled): | |||
if 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 not self.host.is_engine_running(): | |||
return | |||
self.host.transport_pause() | |||
self.host.transport_relocate(0) | |||
self.refreshTransport() | |||
@pyqtSlot() | |||
def slot_transportBackwards(self): | |||
if 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 not self.host.is_engine_running(): | |||
return | |||
newFrame = self.host.get_current_transport_frame() + 100000 | |||
self.host.transport_relocate(newFrame) | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Settings | |||
@@ -1596,11 +1495,6 @@ class HostWindow(QMainWindow, PluginEditParentMeta): | |||
pitem.recreateWidget() | |||
@pyqtSlot(float) | |||
def slot_handleSampleRateChangedCallback(self, newSampleRate): | |||
self.fSampleRate = newSampleRate | |||
self.refreshTransport(True) | |||
# -------------------------------------------------------------------------------------------------------- | |||
@pyqtSlot(int, int, int, float, str) | |||
@@ -1749,7 +1643,7 @@ class HostWindow(QMainWindow, PluginEditParentMeta): | |||
def idleFast(self): | |||
self.host.engine_idle() | |||
self.refreshTransport() | |||
self.fPanelTime.refreshTransport() | |||
if self.fPluginCount == 0: | |||
return | |||
@@ -0,0 +1,230 @@ | |||
#!/usr/bin/env python3 | |||
# -*- coding: utf-8 -*- | |||
# Carla host code | |||
# Copyright (C) 2011-2014 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 QDialog | |||
else: | |||
from PyQt4.QtCore import pyqtSlot | |||
from PyQt4.QtGui import QDialog | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# 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 = CarlaHostMeta() | |||
self.host = host | |||
# ---------------------------------------------------------------------------------------------------- | |||
# Internal stuff | |||
self.fLastTransportFrame = 0 | |||
self.fLastTransportState = False | |||
self.fSampleRate = host.get_sample_rate() if host.is_engine_running() else 0.0 | |||
#if view == TRANSPORT_VIEW_HMS: | |||
#self.fCurTransportView = TRANSPORT_VIEW_HMS | |||
#self.ui.label_time.setMinimumWidth(QFontMetrics(self.ui.label_time.font()).width("00:00:00") + 3) | |||
#elif view == TRANSPORT_VIEW_BBT: | |||
#self.fCurTransportView = TRANSPORT_VIEW_BBT | |||
#self.ui.label_time.setMinimumWidth(QFontMetrics(self.ui.label_time.font()).width("000|00|0000") + 3) | |||
#elif view == TRANSPORT_VIEW_FRAMES: | |||
#self.fCurTransportView = TRANSPORT_VIEW_FRAMES | |||
#self.ui.label_time.setMinimumWidth(QFontMetrics(self.ui.label_time.font()).width("000'000'000") + 3) | |||
# ---------------------------------------------------------------------------------------------------- | |||
# 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) | |||
host.EngineStartedCallback.connect(self.slot_handleEngineStartedCallback) | |||
host.SampleRateChangedCallback.connect(self.slot_handleSampleRateChangedCallback) | |||
# ---------------------------------------------------------------------------------------------------- | |||
# Final setup | |||
self.refreshTransport(True) | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Button actions | |||
@pyqtSlot(bool) | |||
def slot_transportPlayPause(self, toggled): | |||
if 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 not self.host.is_engine_running(): | |||
return | |||
self.host.transport_pause() | |||
self.host.transport_relocate(0) | |||
self.refreshTransport() | |||
@pyqtSlot() | |||
def slot_transportBackwards(self): | |||
if 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 not self.host.is_engine_running(): | |||
return | |||
newFrame = self.host.get_current_transport_frame() + int(self.fSampleRate*2.5) | |||
self.host.transport_relocate(newFrame) | |||
def refreshTransport(self, forced = False): | |||
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'] | |||
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: | |||
time = frame / self.fSampleRate | |||
secs = time % 60 | |||
mins = (time / 60) % 60 | |||
hrs = (time / 3600) % 60 | |||
self.fLastTransportFrame = frame | |||
self.ui.l_time.setText("Transport %s, at %02i:%02i:%02i" % ("playing" if playing else "stopped", hrs, mins, secs)) | |||
#if self.fCurTransportView == TRANSPORT_VIEW_HMS: | |||
#time = pos.frame / int(self.fSampleRate) | |||
#secs = time % 60 | |||
#mins = (time / 60) % 60 | |||
#hrs = (time / 3600) % 60 | |||
#self.ui.label_time.setText("%02i:%02i:%02i" % (hrs, mins, secs)) | |||
#elif self.fCurTransportView == TRANSPORT_VIEW_BBT: | |||
#if pos.valid & jacklib.JackPositionBBT: | |||
#bar = pos.bar | |||
#beat = pos.beat if bar != 0 else 0 | |||
#tick = pos.tick if bar != 0 else 0 | |||
#else: | |||
#bar = 0 | |||
#beat = 0 | |||
#tick = 0 | |||
#self.ui.label_time.setText("%03i|%02i|%04i" % (bar, beat, tick)) | |||
#elif self.fCurTransportView == TRANSPORT_VIEW_FRAMES: | |||
#frame1 = pos.frame % 1000 | |||
#frame2 = (pos.frame / 1000) % 1000 | |||
#frame3 = (pos.frame / 1000000) % 1000 | |||
#self.ui.label_time.setText("%03i'%03i'%03i" % (frame3, frame2, frame1)) | |||
#if pos.valid & jacklib.JackPositionBBT: | |||
#if self.fLastBPM != pos.beats_per_minute: | |||
#self.ui.sb_bpm.setValue(pos.beats_per_minute) | |||
#self.ui.sb_bpm.setStyleSheet("") | |||
#else: | |||
#pos.beats_per_minute = -1.0 | |||
#if self.fLastBPM != pos.beats_per_minute: | |||
#self.ui.sb_bpm.setStyleSheet("QDoubleSpinBox { color: palette(mid); }") | |||
#self.fLastBPM = pos.beats_per_minute | |||
#if state != self.fLastTransportState: | |||
#self.fLastTransportState = state | |||
#if state == jacklib.JackTransportStopped: | |||
#icon = getIcon("media-playback-start") | |||
#self.ui.act_transport_play.setChecked(False) | |||
#self.ui.act_transport_play.setText(self.tr("&Play")) | |||
#self.ui.b_transport_play.setChecked(False) | |||
#else: | |||
#icon = getIcon("media-playback-pause") | |||
#self.ui.act_transport_play.setChecked(True) | |||
#self.ui.act_transport_play.setText(self.tr("&Pause")) | |||
#self.ui.b_transport_play.setChecked(True) | |||
#self.ui.act_transport_play.setIcon(icon) | |||
#self.ui.b_transport_play.setIcon(icon) | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Engine callbacks | |||
@pyqtSlot(str) | |||
def slot_handleEngineStartedCallback(self, processMode, transportMode, driverName): | |||
self.fSampleRate = self.host.get_sample_rate() | |||
@pyqtSlot(float) | |||
def slot_handleSampleRateChangedCallback(self, newSampleRate): | |||
self.fSampleRate = newSampleRate | |||
self.refreshTransport(True) | |||
# ------------------------------------------------------------------------------------------------------------ |