@@ -15,139 +15,6 @@ | |||
</property> | |||
<widget class="QWidget" name="centralwidget"> | |||
<layout class="QVBoxLayout" name="verticalLayout_5"> | |||
<item> | |||
<widget class="QFrame" name="frame_transport"> | |||
<layout class="QHBoxLayout" name="horizontalLayout"> | |||
<property name="leftMargin"> | |||
<number>0</number> | |||
</property> | |||
<property name="rightMargin"> | |||
<number>0</number> | |||
</property> | |||
<property name="bottomMargin"> | |||
<number>0</number> | |||
</property> | |||
<item> | |||
<widget class="QLabel" name="label"> | |||
<property name="text"> | |||
<string>Transport Mode:</string> | |||
</property> | |||
<property name="alignment"> | |||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QComboBox" name="ch_transport"/> | |||
</item> | |||
<item> | |||
<widget class="Line" name="line"> | |||
<property name="orientation"> | |||
<enum>Qt::Vertical</enum> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QPushButton" name="b_transport_play"> | |||
<property name="maximumSize"> | |||
<size> | |||
<width>22</width> | |||
<height>22</height> | |||
</size> | |||
</property> | |||
<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="maximumSize"> | |||
<size> | |||
<width>22</width> | |||
<height>22</height> | |||
</size> | |||
</property> | |||
<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_back"> | |||
<property name="maximumSize"> | |||
<size> | |||
<width>22</width> | |||
<height>22</height> | |||
</size> | |||
</property> | |||
<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> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QPushButton" name="b_transport_forward"> | |||
<property name="maximumSize"> | |||
<size> | |||
<width>22</width> | |||
<height>22</height> | |||
</size> | |||
</property> | |||
<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> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="Line" name="line_2"> | |||
<property name="orientation"> | |||
<enum>Qt::Vertical</enum> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QLabel" name="label_time"> | |||
<property name="text"> | |||
<string>TIME (TODO)</string> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<spacer name="horizontalSpacer"> | |||
<property name="orientation"> | |||
<enum>Qt::Horizontal</enum> | |||
</property> | |||
<property name="sizeHint" stdset="0"> | |||
<size> | |||
<width>40</width> | |||
<height>20</height> | |||
</size> | |||
</property> | |||
</spacer> | |||
</item> | |||
</layout> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QSplitter" name="splitter"> | |||
<property name="orientation"> | |||
@@ -336,7 +203,6 @@ | |||
<string>&Settings</string> | |||
</property> | |||
<addaction name="act_settings_show_toolbar"/> | |||
<addaction name="act_settings_show_transport"/> | |||
<addaction name="separator"/> | |||
<addaction name="act_settings_configure"/> | |||
</widget> | |||
@@ -361,9 +227,19 @@ | |||
<addaction name="act_canvas_print"/> | |||
<addaction name="act_canvas_save_image"/> | |||
</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> | |||
<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"/> | |||
@@ -467,9 +343,6 @@ | |||
<property name="text"> | |||
<string>&Remove All</string> | |||
</property> | |||
<property name="shortcut"> | |||
<string>Ctrl+Shift+R</string> | |||
</property> | |||
</action> | |||
<action name="act_help_about"> | |||
<property name="text"> | |||
@@ -649,6 +522,57 @@ | |||
<string>Ctrl+1</string> | |||
</property> | |||
</action> | |||
<action name="act_transport_play"> | |||
<property name="checkable"> | |||
<bool>true</bool> | |||
</property> | |||
<property name="icon"> | |||
<iconset resource="../resources.qrc"> | |||
<normaloff>:/16x16/media-playback-start.png</normaloff>:/16x16/media-playback-start.png</iconset> | |||
</property> | |||
<property name="text"> | |||
<string>&Play</string> | |||
</property> | |||
<property name="shortcut"> | |||
<string>Ctrl+Shift+P</string> | |||
</property> | |||
</action> | |||
<action name="act_transport_stop"> | |||
<property name="icon"> | |||
<iconset resource="../resources.qrc"> | |||
<normaloff>:/16x16/media-playback-stop.png</normaloff>:/16x16/media-playback-stop.png</iconset> | |||
</property> | |||
<property name="text"> | |||
<string>&Stop</string> | |||
</property> | |||
<property name="shortcut"> | |||
<string>Ctrl+Shift+X</string> | |||
</property> | |||
</action> | |||
<action name="act_transport_backwards"> | |||
<property name="icon"> | |||
<iconset resource="../resources.qrc"> | |||
<normaloff>:/16x16/media-seek-backward.png</normaloff>:/16x16/media-seek-backward.png</iconset> | |||
</property> | |||
<property name="text"> | |||
<string>&Backwards</string> | |||
</property> | |||
<property name="shortcut"> | |||
<string>Ctrl+Shift+B</string> | |||
</property> | |||
</action> | |||
<action name="act_transport_forwards"> | |||
<property name="icon"> | |||
<iconset resource="../resources.qrc"> | |||
<normaloff>:/16x16/media-seek-forward.png</normaloff>:/16x16/media-seek-forward.png</iconset> | |||
</property> | |||
<property name="text"> | |||
<string>&Forwards</string> | |||
</property> | |||
<property name="shortcut"> | |||
<string>Ctrl+Shift+F</string> | |||
</property> | |||
</action> | |||
</widget> | |||
<customwidgets> | |||
<customwidget> | |||
@@ -694,21 +618,5 @@ | |||
</hint> | |||
</hints> | |||
</connection> | |||
<connection> | |||
<sender>act_settings_show_transport</sender> | |||
<signal>triggered(bool)</signal> | |||
<receiver>frame_transport</receiver> | |||
<slot>setVisible(bool)</slot> | |||
<hints> | |||
<hint type="sourcelabel"> | |||
<x>-1</x> | |||
<y>-1</y> | |||
</hint> | |||
<hint type="destinationlabel"> | |||
<x>377</x> | |||
<y>65</y> | |||
</hint> | |||
</hints> | |||
</connection> | |||
</connections> | |||
</ui> |
@@ -178,6 +178,7 @@ CARLA_EXPORT void carla_patchbay_refresh(); | |||
CARLA_EXPORT void carla_transport_play(); | |||
CARLA_EXPORT void carla_transport_pause(); | |||
CARLA_EXPORT void carla_transport_relocate(uint32_t frames); | |||
CARLA_EXPORT uint64_t carla_get_current_transport_frame(); | |||
CARLA_EXPORT bool carla_add_plugin(CarlaBinaryType btype, CarlaPluginType ptype, const char* filename, const char* name, const char* label, const void* extraPtr); | |||
CARLA_EXPORT bool carla_remove_plugin(unsigned int pluginId); | |||
@@ -572,7 +572,7 @@ void carla_transport_play() | |||
CARLA_ASSERT(standalone.engine != nullptr); | |||
if (standalone.engine != nullptr) | |||
return standalone.engine->transportPlay(); | |||
standalone.engine->transportPlay(); | |||
} | |||
void carla_transport_pause() | |||
@@ -581,7 +581,7 @@ void carla_transport_pause() | |||
CARLA_ASSERT(standalone.engine != nullptr); | |||
if (standalone.engine != nullptr) | |||
return standalone.engine->transportPause(); | |||
standalone.engine->transportPause(); | |||
} | |||
void carla_transport_relocate(uint32_t frames) | |||
@@ -590,7 +590,20 @@ void carla_transport_relocate(uint32_t frames) | |||
CARLA_ASSERT(standalone.engine != nullptr); | |||
if (standalone.engine != nullptr) | |||
return standalone.engine->transportRelocate(frames); | |||
standalone.engine->transportRelocate(frames); | |||
} | |||
uint64_t carla_get_current_transport_frame() | |||
{ | |||
CARLA_ASSERT(standalone.engine != nullptr); | |||
if (standalone.engine != nullptr) | |||
{ | |||
const CarlaBackend::EngineTimeInfo& timeInfo(standalone.engine->getTimeInfo()); | |||
return timeInfo.frame; | |||
} | |||
return 0; | |||
} | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
@@ -566,6 +566,7 @@ class CarlaMainW(QMainWindow): | |||
self.fInfoLabel = QLabel(self) | |||
self.fInfoLabel.setText("") | |||
self.fInfoText = "" | |||
self.fDirModel = QFileSystemModel(self) | |||
self.fDirModel.setNameFilters(cString(Carla.host.get_supported_file_types()).split(";")) | |||
@@ -659,9 +660,10 @@ class CarlaMainW(QMainWindow): | |||
self.connect(self.ui.act_help_about, SIGNAL("triggered()"), SLOT("slot_aboutCarla()")) | |||
self.connect(self.ui.act_help_about_qt, SIGNAL("triggered()"), app, SLOT("aboutQt()")) | |||
self.connect(self.ui.ch_transport, SIGNAL("currentIndexChanged(int)"), SLOT("slot_transportModeChanged(int)")) | |||
self.connect(self.ui.b_transport_play, SIGNAL("clicked(bool)"), SLOT("slot_transportPlayPause(bool)")) | |||
self.connect(self.ui.b_transport_stop, SIGNAL("clicked()"), SLOT("slot_transportStop()")) | |||
self.connect(self.ui.act_transport_play, SIGNAL("triggered(bool)"), SLOT("slot_transportPlayPause(bool)")) | |||
self.connect(self.ui.act_transport_stop, SIGNAL("triggered()"), SLOT("slot_transportStop()")) | |||
self.connect(self.ui.act_transport_backwards, SIGNAL("triggered()"), SLOT("slot_transportBackwards()")) | |||
self.connect(self.ui.act_transport_forwards, SIGNAL("triggered()"), SLOT("slot_transportForwards()")) | |||
self.connect(self.ui.graphicsView.horizontalScrollBar(), SIGNAL("valueChanged(int)"), SLOT("slot_horizontalScrollBarChanged(int)")) | |||
self.connect(self.ui.graphicsView.verticalScrollBar(), SIGNAL("valueChanged(int)"), SLOT("slot_verticalScrollBarChanged(int)")) | |||
@@ -969,23 +971,15 @@ class CarlaMainW(QMainWindow): | |||
else: | |||
maxCount = MAX_DEFAULT_PLUGINS | |||
self.ui.ch_transport.blockSignals(True) | |||
self.ui.ch_transport.addItem(self.tr("Internal")) | |||
if audioDriver == "JACK": | |||
self.ui.ch_transport.addItem(self.tr("JACK")) | |||
elif transportMode == TRANSPORT_MODE_JACK: | |||
if transportMode == TRANSPORT_MODE_JACK and audioDriver != "JACK": | |||
transportMode = TRANSPORT_MODE_INTERNAL | |||
self.ui.ch_transport.setCurrentIndex(transportMode) | |||
self.ui.ch_transport.blockSignals(False) | |||
for x in range(maxCount): | |||
self.fPluginList.append(None) | |||
Carla.host.set_engine_option(OPTION_TRANSPORT_MODE, transportMode, "") | |||
# Peaks | |||
# Peaks and TimeInfo | |||
self.fIdleTimerFast = self.startTimer(self.fSavedSettings["Main/RefreshInterval"]) | |||
# LEDs and edit dialog parameters | |||
self.fIdleTimerSlow = self.startTimer(self.fSavedSettings["Main/RefreshInterval"]*2) | |||
@@ -1010,12 +1004,6 @@ class CarlaMainW(QMainWindow): | |||
self.killTimer(self.fIdleTimerFast) | |||
self.killTimer(self.fIdleTimerSlow) | |||
settings = QSettings() | |||
settings.setValue("Engine/TransportMode", self.ui.ch_transport.currentIndex()) | |||
self.ui.ch_transport.blockSignals(True) | |||
self.ui.ch_transport.clear() | |||
self.ui.ch_transport.blockSignals(False) | |||
patchcanvas.clear() | |||
def loadProject(self, filename): | |||
@@ -1119,14 +1107,14 @@ class CarlaMainW(QMainWindow): | |||
self.ui.act_engine_start.setEnabled(not check) | |||
self.ui.act_engine_stop.setEnabled(check) | |||
self.ui.act_engine_configure.setEnabled(not check) | |||
self.ui.frame_transport.setEnabled(check) | |||
if check: | |||
bufferSize = Carla.host.get_buffer_size() | |||
sampleRate = Carla.host.get_sample_rate() | |||
self.fInfoLabel.setText("Engine running, using %g sample rate and %i buffer size" % (sampleRate, bufferSize)) | |||
else: | |||
self.fInfoLabel.setText("Engine failed to start") | |||
self.fInfoText = "Engine running | SampleRate: %g | BufferSize: %i" % (sampleRate, bufferSize) | |||
self.fInfoLabel.setText(self.fInfoText) | |||
self.menuTransport(check) | |||
@pyqtSlot() | |||
def slot_engineStop(self): | |||
@@ -1135,13 +1123,13 @@ class CarlaMainW(QMainWindow): | |||
self.ui.act_file_open.setEnabled(check) | |||
self.ui.act_engine_start.setEnabled(not check) | |||
self.ui.act_engine_stop.setEnabled(check) | |||
self.ui.frame_transport.setEnabled(check) | |||
if check: | |||
self.fInfoLabel.setText("Engine failed to stop, still running...") | |||
else: | |||
if not check: | |||
self.fInfoText = "" | |||
self.fInfoLabel.setText("Engine stopped") | |||
self.menuTransport(check) | |||
@pyqtSlot() | |||
def slot_pluginAdd(self): | |||
dialog = PluginDatabaseW(self) | |||
@@ -1157,26 +1145,67 @@ class CarlaMainW(QMainWindow): | |||
def slot_pluginRemoveAll(self): | |||
self.removeAllPlugins() | |||
self.connect(self.ui.ch_transport, SIGNAL("currentIndexChanged(int)"), SLOT("(int)")) | |||
self.connect(self.ui.b_transport_play, SIGNAL("clicked(bool)"), SLOT("(bool)")) | |||
self.connect(self.ui.b_transport_stop, SIGNAL("clicked()"), SLOT("()")) | |||
def menuTransport(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) | |||
@pyqtSlot(int) | |||
def slot_transportModeChanged(self, newMode): | |||
Carla.host.set_engine_option(OPTION_TRANSPORT_MODE, newMode, "") | |||
def refreshTransport(self): | |||
if not self.fEngineStarted: | |||
return | |||
time = Carla.host.get_current_transport_frame() / int(Carla.host.get_sample_rate()) | |||
secs = time % 60 | |||
mins = (time / 60) % 60 | |||
hrs = (time / 3600) % 60 | |||
textTransport = "Transport %s, at %02i:%02i:%02i" % ("<TODO>", hrs, mins, secs) | |||
self.fInfoLabel.setText("%s | %s" % (self.fInfoText, textTransport)) | |||
@pyqtSlot(bool) | |||
def slot_transportPlayPause(self, toggled): | |||
if not self.fEngineStarted: | |||
return | |||
if toggled: | |||
Carla.host.transport_play() | |||
else: | |||
Carla.host.transport_pause() | |||
self.refreshTransport() | |||
@pyqtSlot() | |||
def slot_transportStop(self): | |||
if not self.fEngineStarted: | |||
return | |||
Carla.host.transport_pause() | |||
Carla.host.transport_relocate(0) | |||
self.refreshTransport() | |||
@pyqtSlot() | |||
def slot_transportBackwards(self): | |||
if not self.fEngineStarted: | |||
return | |||
newFrame = Carla.host.get_current_transport_frame() - 100000 | |||
if newFrame < 0: | |||
newFrame = 0 | |||
Carla.host.transport_relocate(newFrame) | |||
@pyqtSlot() | |||
def slot_transportForwards(self): | |||
if not self.fEngineStarted: | |||
return | |||
newFrame = Carla.host.get_current_transport_frame() + 100000 | |||
Carla.host.transport_relocate(newFrame) | |||
@pyqtSlot() | |||
def slot_aboutCarla(self): | |||
CarlaAboutW(self).exec_() | |||
@@ -1553,7 +1582,6 @@ class CarlaMainW(QMainWindow): | |||
settings.setValue("Geometry", self.saveGeometry()) | |||
settings.setValue("SplitterState", self.ui.splitter.saveState()) | |||
settings.setValue("ShowToolbar", self.ui.toolBar.isVisible()) | |||
#settings.setValue("ShowTransport", self.ui.frame_transport.isVisible()) | |||
settings.setValue("HorizontalScrollBarValue", self.ui.graphicsView.horizontalScrollBar().value()) | |||
settings.setValue("VerticalScrollBarValue", self.ui.graphicsView.verticalScrollBar().value()) | |||
@@ -1567,11 +1595,6 @@ class CarlaMainW(QMainWindow): | |||
self.ui.act_settings_show_toolbar.setChecked(showToolbar) | |||
self.ui.toolBar.setVisible(showToolbar) | |||
#showTransport = settings.value("ShowTransport", True, type=bool) | |||
#self.ui.act_settings_show_transport.setChecked(showTransport) | |||
#self.ui.frame_transport.setVisible(showTransport) | |||
self.ui.frame_transport.setVisible(False) | |||
if settings.contains("SplitterState"): | |||
self.ui.splitter.restoreState(settings.value("SplitterState", "")) | |||
else: | |||
@@ -1643,6 +1666,8 @@ class CarlaMainW(QMainWindow): | |||
break | |||
pwidget.idleFast() | |||
self.refreshTransport() | |||
elif event.timerId() == self.fIdleTimerSlow: | |||
for pwidget in self.fPluginList: | |||
if pwidget is None: | |||
@@ -212,6 +212,9 @@ class Host(object): | |||
self.lib.carla_transport_relocate.argtypes = [c_uint32] | |||
self.lib.carla_transport_relocate.restype = None | |||
self.lib.carla_get_current_transport_frame.argtypes = None | |||
self.lib.carla_get_current_transport_frame.restype = c_uint64 | |||
self.lib.carla_add_plugin.argtypes = [c_enum, c_enum, c_char_p, c_char_p, c_char_p, c_void_p] | |||
self.lib.carla_add_plugin.restype = c_bool | |||
@@ -443,6 +446,9 @@ class Host(object): | |||
def transport_relocate(self, frames): | |||
self.lib.carla_transport_relocate(frames) | |||
def get_current_transport_frame(self): | |||
return self.lib.carla_get_current_transport_frame() | |||
def add_plugin(self, btype, ptype, filename, name, label, extraStuff): | |||
cfilename = filename.encode("utf-8") if filename else c_nullptr | |||
cname = name.encode("utf-8") if name else c_nullptr | |||