Render: Add custom filename prefix option (Closes #25)

This commit is contained in:
falkTX 2013-07-15 03:57:09 +01:00
parent 66b773de7d
commit c119b1c2da
4 changed files with 252 additions and 228 deletions

View File

@ -14,56 +14,6 @@
<string>Render</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QProgressBar" name="progressBar">
<property name="maximum">
<number>1</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="format">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="b_render">
<property name="text">
<string>&amp;Render</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/16x16/media-record.png</normaloff>:/16x16/media-record.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="b_stop">
<property name="text">
<string>&amp;Stop</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_close">
<property name="text">
<string>&amp;Close</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/16x16/window-close.png</normaloff>:/16x16/window-close.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
@ -71,167 +21,6 @@
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="group_render">
<property name="title">
<string>Render Options</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Render &amp;Mode:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>cb_render_mode</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cb_render_mode">
<item>
<property name="text">
<string>Realtime</string>
</property>
</item>
<item>
<property name="text">
<string>Freewheel</string>
</property>
</item>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>275</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&amp;Buffer Size:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>cb_buffer_size</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cb_buffer_size">
<property name="editable">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>32</string>
</property>
</item>
<item>
<property name="text">
<string>64</string>
</property>
</item>
<item>
<property name="text">
<string>128</string>
</property>
</item>
<item>
<property name="text">
<string>256</string>
</property>
</item>
<item>
<property name="text">
<string>512</string>
</property>
</item>
<item>
<property name="text">
<string>1024</string>
</property>
</item>
<item>
<property name="text">
<string>2048</string>
</property>
</item>
<item>
<property name="text">
<string>4096</string>
</property>
</item>
<item>
<property name="text">
<string>8192</string>
</property>
</item>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>275</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Output folder:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="le_folder"/>
</item>
<item>
<widget class="QToolButton" name="b_open">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/16x16/document-open.png</normaloff>:/16x16/document-open.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="group_encoding">
<property name="title">
@ -340,6 +129,56 @@
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QProgressBar" name="progressBar">
<property name="maximum">
<number>1</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="format">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="b_render">
<property name="text">
<string>&amp;Render</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/16x16/media-record.png</normaloff>:/16x16/media-record.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="b_stop">
<property name="text">
<string>&amp;Stop</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_close">
<property name="text">
<string>&amp;Close</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/16x16/window-close.png</normaloff>:/16x16/window-close.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="group_time">
<property name="title">
@ -406,6 +245,184 @@
</layout>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="group_render">
<property name="title">
<string>Render Options</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Render &amp;Mode:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>cb_render_mode</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cb_render_mode">
<item>
<property name="text">
<string>Realtime</string>
</property>
</item>
<item>
<property name="text">
<string>Freewheel</string>
</property>
</item>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>275</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cb_buffer_size">
<property name="editable">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>32</string>
</property>
</item>
<item>
<property name="text">
<string>64</string>
</property>
</item>
<item>
<property name="text">
<string>128</string>
</property>
</item>
<item>
<property name="text">
<string>256</string>
</property>
</item>
<item>
<property name="text">
<string>512</string>
</property>
</item>
<item>
<property name="text">
<string>1024</string>
</property>
</item>
<item>
<property name="text">
<string>2048</string>
</property>
</item>
<item>
<property name="text">
<string>4096</string>
</property>
</item>
<item>
<property name="text">
<string>8192</string>
</property>
</item>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>275</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&amp;Buffer Size:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>cb_buffer_size</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Output folder:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="le_folder"/>
</item>
<item>
<widget class="QToolButton" name="b_open">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/16x16/document-open.png</normaloff>:/16x16/document-open.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="le_prefix">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Filename prefix:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>

View File

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# JACK ctypes definitions for usage in python applications
# Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2010-2013 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
@ -50,7 +50,7 @@ except:
# ------------------------------------------------------------------------------------------------------------
# Pre-Types
c_enum = c_int
c_enum = c_int
c_uchar = c_uint8
class _jack_port(Structure):
@ -59,9 +59,6 @@ class _jack_port(Structure):
class _jack_client(Structure):
_fields_ = []
class pthread_t(Structure):
_fields_ = []
# ------------------------------------------------------------------------------------------------------------
# Defines
@ -91,7 +88,7 @@ jack_latency_callback_mode_t = c_enum # JackLatencyCallbackMode
jack_port_t = _jack_port
jack_client_t = _jack_client
jack_port_type_id_t = c_uint32 # JACK2 only
jack_port_type_id_t = c_uint32 # JACK2 only
# enum JackOptions
JackNullOption = 0x00

View File

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# Helper functions for extra jacklib functionality
# Copyright (C) 2012 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2012-2013 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
@ -28,8 +28,12 @@ except ImportError:
# Get JACK error status as string
def get_jack_status_error_string(cStatus):
status = cStatus.value
if status == 0x0:
return ""
errorString = ""
status = cStatus.value
if status & jacklib.JackFailure:
errorString += "Overall operation failed;\n"
@ -58,10 +62,7 @@ def get_jack_status_error_string(cStatus):
if status & jacklib.JackClientZombie:
errorString += "Client is being shutdown against its will;\n"
if errorString:
errorString = errorString.strip().rsplit(";", 1)[0] + "."
return errorString
return errorString.strip().rsplit(";", 1)[0] + "."
# ------------------------------------------------------------------------------------------------------------
# Convert C char** -> Python list

View File

@ -196,6 +196,14 @@ class RenderW(QDialog):
arguments = []
# Filename prefix
arguments.append("-fp")
arguments.append(self.ui.le_prefix.text())
# Format
arguments.append("-f")
arguments.append(self.ui.cb_format.currentText())
# Bit depth
arguments.append("-b")
arguments.append(self.ui.cb_depth.currentText())
@ -209,10 +217,6 @@ class RenderW(QDialog):
else:
arguments.append(str(self.ui.sb_channels.value()))
# Format
arguments.append("-f")
arguments.append(self.ui.cb_format.currentText())
# Controlled by transport
if useTransport:
arguments.append("-jt")
@ -339,6 +343,7 @@ class RenderW(QDialog):
settings.setValue("Geometry", self.saveGeometry())
settings.setValue("OutputFolder", self.ui.le_folder.text())
settings.setValue("FilenamePrefix", self.ui.le_prefix.text())
settings.setValue("EncodingFormat", self.ui.cb_format.currentText())
settings.setValue("EncodingDepth", self.ui.cb_depth.currentText())
settings.setValue("EncodingChannels", channels)
@ -356,6 +361,8 @@ class RenderW(QDialog):
if os.path.exists(outputFolder):
self.ui.le_folder.setText(outputFolder)
self.ui.le_prefix.setText(settings.value("FilenamePrefix", "jack_capture_"))
encFormat = settings.value("EncodingFormat", "Wav", type=str)
for i in range(self.ui.cb_format.count()):
@ -385,9 +392,11 @@ class RenderW(QDialog):
self.ui.te_end.setTime(settings.value("EndTime", self.ui.te_end.time(), type=QTime))
def closeEvent(self, event):
self.saveSettings()
if self.fJackClient:
jacklib.client_close(self.fJackClient)
self.saveSettings()
QDialog.closeEvent(self, event)
def done(self, r):