summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2018-10-07 15:56:09 +1100
committerDamien Zammit <damien@zamaudio.com>2018-10-07 15:56:09 +1100
commit50451acbe0ae4dcf10249258623f3ac41c6709a1 (patch)
treea0469173d07bbdd84dd9d4f2fcb326e8f56e7fae
parentfbe48876dc562167f75bca5e38b93a81840f4b2e (diff)
ptgenmissing: Create script for regenerating dummy missing audio files
-rw-r--r--Makefile5
-rw-r--r--ptgenmissing.cc63
2 files changed, 67 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index b454029..515f37f 100644
--- a/Makefile
+++ b/Makefile
@@ -6,14 +6,17 @@ CLANGSTRICT=-Woverloaded-virtual -Wno-mismatched-tags -ansi -Wnon-virtual-dtor -
all:
$(CXX) -o ptftool -g ${INCL} ${STRICT} ptftool.cc ptfformat.cc
$(CXX) -o ptunxor -g ${INCL} ${STRICT} ptunxor.cc ptfformat.cc
+ $(CXX) -o ptgenmissing -g ${INCL} ${STRICT} ptgenmissing.cc ptfformat.cc
all32:
$(CXX) -m32 -o ptftool -g ${INCL32} ${STRICT} ptftool.cc ptfformat.cc
$(CXX) -m32 -o ptunxor -g ${INCL32} ${STRICT} ptunxor.cc ptfformat.cc
+ $(CXX) -m32 -o ptgenmissing -g ${INCL32} ${STRICT} ptgenmissing.cc ptfformat.cc
clangall:
clang++ -o ptftool -g ${INCL} ${CLANGSTRICT} ptftool.cc ptfformat.cc
clang++ -o ptunxor -g ${INCL} ${CLANGSTRICT} ptunxor.cc ptfformat.cc
+ clang++ -o ptgenmissing -g ${INCL} ${CLANGSTRICT} ptgenmissing.cc ptfformat.cc
clean:
- rm ptftool ptunxor
+ rm ptftool ptunxor ptgenmissing
diff --git a/ptgenmissing.cc b/ptgenmissing.cc
new file mode 100644
index 0000000..b34ed88
--- /dev/null
+++ b/ptgenmissing.cc
@@ -0,0 +1,63 @@
+/*
+ * libptformat - a library to read ProTools sessions
+ *
+ * Copyright (C) 2015 Damien Zammit
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "ptfformat.h"
+#include <inttypes.h> // PRIx
+#include <cstdio>
+
+using namespace std;
+using std::string;
+
+int main (int argc, char **argv) {
+ PTFFormat ptf;
+ int ok;
+
+ if (argc == 1) {
+ printf("No ptf file specified, quit\n");
+ exit(0);
+ }
+
+ ok = ptf.load(argv[1], 48000);
+
+ switch (ok) {
+ default:
+ case -1:
+ printf("Cannot open ptf, quit\n");
+ exit(-1);
+ break;
+ case 0:
+ printf("#!/bin/bash\nset -e\nmkdir \"Audio Files\"\n");
+ for (vector<PTFFormat::wav_t>::iterator a = ptf.audiofiles.begin();
+ a != ptf.audiofiles.end(); ++a) {
+ if (!a->length) {
+ printf("# unknown length : %s\n", a->filename.c_str());
+ } else {
+ printf("sox --no-clobber -S -n -r %" PRId64 " -c 1 -b 16 \"Audio Files\"/\"%s\" synth %" PRId64 "s sine 1000 gain -18\n",
+ ptf.sessionrate,
+ a->filename.c_str(),
+ a->length
+ );
+ }
+ }
+ break;
+ }
+ exit(0);
+}