From c119b1c2da02fe65e4670e0d1d2b58ff7035e81b Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 15 Jul 2013 03:57:09 +0100 Subject: [PATCH] Render: Add custom filename prefix option (Closes #25) --- resources/ui/render.ui | 377 +++++++++++++++++++++-------------------- src/jacklib.py | 9 +- src/jacklib_helpers.py | 13 +- src/render.py | 19 ++- 4 files changed, 221 insertions(+), 197 deletions(-) diff --git a/resources/ui/render.ui b/resources/ui/render.ui index b3a6c49..047dcac 100644 --- a/resources/ui/render.ui +++ b/resources/ui/render.ui @@ -14,6 +14,121 @@ Render + + + + Qt::Horizontal + + + + + + + Encoding + + + + + + &Format: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + cb_format + + + + + + + + + + false + + + ... + + + + + + + Bit &Depth: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + cb_depth + + + + + + + + 8 + + + + + 16 + + + + + 24 + + + + + 32 + + + + + Float + + + + + + + + Mono + + + + + + + Stereo + + + + + + + Other: + + + + + + + false + + + 3 + + + + + + @@ -64,11 +179,70 @@ - - - - Qt::Horizontal + + + + Use Transport + + true + + + + + + &Start Time: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + te_start + + + + + + + hh:mm:ss + + + + + + + &End Time: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + te_end + + + + + + + hh:mm:ss + + + + + + + now + + + + + + + now + + + + @@ -120,19 +294,6 @@ - - - - &Buffer Size: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - cb_buffer_size - - - @@ -201,6 +362,19 @@ + + + + &Buffer Size: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + cb_buffer_size + + + @@ -229,178 +403,21 @@ - - - - - - - Encoding - - - - + + - &Format: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - cb_format + - - - - - - - false - - - ... - - - - - + + - Bit &Depth: + Filename prefix: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - cb_depth - - - - - - - - 8 - - - - - 16 - - - - - 24 - - - - - 32 - - - - - Float - - - - - - - - Mono - - - - - - - Stereo - - - - - - - Other: - - - - - - - false - - - 3 - - - - - - - - - - Use Transport - - - true - - - - - - &Start Time: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - te_start - - - - - - - hh:mm:ss - - - - - - - &End Time: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - te_end - - - - - - - hh:mm:ss - - - - - - - now - - - - - - - now - diff --git a/src/jacklib.py b/src/jacklib.py index 990536e..55ee354 100644 --- a/src/jacklib.py +++ b/src/jacklib.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # JACK ctypes definitions for usage in python applications -# Copyright (C) 2010-2012 Filipe Coelho +# Copyright (C) 2010-2013 Filipe Coelho # # 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 diff --git a/src/jacklib_helpers.py b/src/jacklib_helpers.py index ba76a29..319f227 100644 --- a/src/jacklib_helpers.py +++ b/src/jacklib_helpers.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Helper functions for extra jacklib functionality -# Copyright (C) 2012 Filipe Coelho +# Copyright (C) 2012-2013 Filipe Coelho # # 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 diff --git a/src/render.py b/src/render.py index 3cecd38..e4b117e 100755 --- a/src/render.py +++ b/src/render.py @@ -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):