# HG changeset patch # User Chris Cannam # Date 1413274831 -3600 # Node ID 45480b73f4af9cf216d939b28b454631b9c0178e # Parent 6b62bae0af33ffdb6db23ed1a2da2318e702b52e# Parent b3d73c08b6cefe4c98777d0c0381dcbac6e99c40 Merge from default branch diff -r 6b62bae0af33 -r 45480b73f4af .hgsubstate --- a/.hgsubstate Mon Oct 13 13:53:00 2014 +0100 +++ b/.hgsubstate Tue Oct 14 09:20:31 2014 +0100 @@ -1,3 +1,3 @@ d16f0fd6db6104d87882bc43788a3bb1b0f8c528 dataquay 879bdc878826bebec67130326f99397c430419b1 sv-dependency-builds -2104ea2204d2b8e5f19401526d8009ac8eba63ea svcore +e25dc8d575656f0409233b29a3f621eb225bbd52 svcore diff -r 6b62bae0af33 -r 45480b73f4af runner/AudioDBFeatureWriter.cpp --- a/runner/AudioDBFeatureWriter.cpp Mon Oct 13 13:53:00 2014 +0100 +++ b/runner/AudioDBFeatureWriter.cpp Tue Oct 14 09:20:31 2014 +0100 @@ -54,6 +54,12 @@ // TODO: error handling on close } +string +AudioDBFeatureWriter::getDescription() const +{ + return "Write features in a binary format intended for import into AudioDB."; +} + AudioDBFeatureWriter::ParameterList AudioDBFeatureWriter::getSupportedParameters() const { diff -r 6b62bae0af33 -r 45480b73f4af runner/AudioDBFeatureWriter.h --- a/runner/AudioDBFeatureWriter.h Mon Oct 13 13:53:00 2014 +0100 +++ b/runner/AudioDBFeatureWriter.h Tue Oct 14 09:20:31 2014 +0100 @@ -30,6 +30,8 @@ AudioDBFeatureWriter(); virtual ~AudioDBFeatureWriter(); + virtual string getDescription() const; + virtual ParameterList getSupportedParameters() const; virtual void setParameters(map ¶ms); diff -r 6b62bae0af33 -r 45480b73f4af runner/DefaultFeatureWriter.cpp --- a/runner/DefaultFeatureWriter.cpp Mon Oct 13 13:53:00 2014 +0100 +++ b/runner/DefaultFeatureWriter.cpp Tue Oct 14 09:20:31 2014 +0100 @@ -20,6 +20,12 @@ #include "DefaultFeatureWriter.h" +string +DefaultFeatureWriter::getDescription() const +{ + return "Write features in a generic XML format, with or elements containing output name and some or all of timestamp, duration, values, and label."; +} + void DefaultFeatureWriter::write(QString, const Transform &, const Vamp::Plugin::OutputDescriptor& output, diff -r 6b62bae0af33 -r 45480b73f4af runner/DefaultFeatureWriter.h --- a/runner/DefaultFeatureWriter.h Mon Oct 13 13:53:00 2014 +0100 +++ b/runner/DefaultFeatureWriter.h Tue Oct 14 09:20:31 2014 +0100 @@ -23,6 +23,7 @@ { public: virtual ~DefaultFeatureWriter() { } + virtual string getDescription() const; virtual void write(QString trackid, const Transform &transform, const Vamp::Plugin::OutputDescriptor &output, diff -r 6b62bae0af33 -r 45480b73f4af runner/MIDIFeatureWriter.cpp --- a/runner/MIDIFeatureWriter.cpp Mon Oct 13 13:53:00 2014 +0100 +++ b/runner/MIDIFeatureWriter.cpp Tue Oct 14 09:20:31 2014 +0100 @@ -34,6 +34,12 @@ { } +string +MIDIFeatureWriter::getDescription() const +{ + return "Write features to MIDI files. All features are written as MIDI notes. If a feature has at least one value, its first value will be used as the note pitch, the second value (if present) for velocity. If a feature has units of Hz, then its pitch will be converted from frequency to an integer value in MIDI range, otherwise it will be written directly. Multiple (up to 16) transforms can be written to a single MIDI file, where they will be given separate MIDI channel numbers."; +} + MIDIFeatureWriter::ParameterList MIDIFeatureWriter::getSupportedParameters() const { diff -r 6b62bae0af33 -r 45480b73f4af runner/MIDIFeatureWriter.h --- a/runner/MIDIFeatureWriter.h Mon Oct 13 13:53:00 2014 +0100 +++ b/runner/MIDIFeatureWriter.h Tue Oct 14 09:20:31 2014 +0100 @@ -28,6 +28,8 @@ MIDIFeatureWriter(); virtual ~MIDIFeatureWriter(); + string getDescription() const; + virtual ParameterList getSupportedParameters() const; virtual void setParameters(map ¶ms); diff -r 6b62bae0af33 -r 45480b73f4af runner/main.cpp --- a/runner/main.cpp Mon Oct 13 13:53:00 2014 +0100 +++ b/runner/main.cpp Tue Oct 14 09:20:31 2014 +0100 @@ -311,7 +311,9 @@ cerr << endl; cerr << "Housekeeping options:" << endl; cerr << endl; - cerr << " -l, --list List all known transform ids to standard output." << endl; + cerr << " -l, --list List available transform ids to standard output." << endl; + cerr << " --list-writers List supported writer types to standard output." << endl; + cerr << " --list-formats List supported input audio formats to standard output." << endl; cerr << endl; cerr << " -s, --skeleton Generate a skeleton transform file for transform id " << endl; cerr << " and write it to standard output." << endl; @@ -338,12 +340,14 @@ << writer << "\")" << endl; return; } + cerr << "Feature writer \"" << writer << "\":" << endl << endl; + cerr << " " << wrap(w->getDescription().c_str(), 76, 2) << endl << endl; cerr << "Additional options for writer type \"" << writer << "\":" << endl; cerr << endl; FeatureWriter::ParameterList params = w->getSupportedParameters(); delete w; if (params.empty()) { - cerr << "(No special options available for this writer)" << endl; + cerr << " No additional options are available for this writer." << endl << endl; return; } for (FeatureWriter::ParameterList::const_iterator j = params.begin(); @@ -468,6 +472,8 @@ bool recursive = false; bool normalise = false; bool list = false; + bool listWriters = false; + bool listFormats = false; bool summaryOnly = false; QString skeletonFor = ""; QString minVersion = ""; @@ -606,6 +612,12 @@ } else if (arg == "-f" || arg == "--force") { force = true; continue; + } else if (arg == "--list-writers") { + listWriters = true; + continue; + } else if (arg == "--list-formats") { + listFormats = true; + continue; } else if (arg == "-l" || arg == "--list") { list = true; continue; @@ -642,6 +654,47 @@ listTransforms(); exit(0); } + if (listWriters) { + if (!requestedWriterTags.empty() || skeletonFor != "") { + cerr << helpStr << endl; + exit(2); + } + set writers = FeatureWriterFactory::getWriterTags(); + bool first = true; + for (set::const_iterator i = writers.begin(); + i != writers.end(); ++i) { + if (!first) cout << " "; + cout << *i; + first = false; + } + cout << endl; + exit(0); + } + if (listFormats) { + if (!requestedWriterTags.empty() || skeletonFor != "") { + cerr << helpStr << endl; + exit(2); + } + QString extensions = AudioFileReaderFactory::getKnownExtensions(); + QStringList extlist = extensions.split(" ", QString::SkipEmptyParts); + bool first = true; + foreach (QString s, extlist) { + if (!first) cout << " "; + s.replace("*.", ""); + cout << s; + first = false; + } + cout << endl; + exit(0); + } + if (list) { + if (!requestedWriterTags.empty() || skeletonFor != "") { + cerr << helpStr << endl; + exit(2); + } + listTransforms(); + exit(0); + } if (skeletonFor != "") { if (!requestedWriterTags.empty()) { cerr << helpStr << endl; diff -r 6b62bae0af33 -r 45480b73f4af tests/test-as-advertised/test-as-advertised.sh --- a/tests/test-as-advertised/test-as-advertised.sh Mon Oct 13 13:53:00 2014 +0100 +++ b/tests/test-as-advertised/test-as-advertised.sh Tue Oct 14 09:20:31 2014 +0100 @@ -8,19 +8,14 @@ trap "rm -rf $tmpdir" 0 -types=`\ - $r --help 2>&1 | \ - grep 'Supported writer types are:' | \ - sed -e 's/^.*://' -e 's/[,\.]//g' \ - ` +types=`$r --list-writers` [ -n "$types" ] || \ - fail "Fails to report sensible list of writers in help text?" + fail "Fails to report list of writers" onsets=$mypath/transforms/percussiononsets-onsets.n3 df=$mypath/transforms/percussiononsets-detectionfunction.n3 adbdir=$tmpdir/audiodb-test -mkdir -p $adbdir for type in $types; do @@ -39,6 +34,7 @@ case $type in audiodb) + mkdir -p $adbdir $r -t $df -w $type $tmpwav --audiodb-basedir $tmpdir --audiodb-catid `basename $adbdir` 2>/dev/null || \ fail "Fails to run with reader type \"$type\" and default options" ;;