summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drumgizmo/dgvalidator.cc41
-rw-r--r--man/dgvalidator.136
2 files changed, 76 insertions, 1 deletions
diff --git a/drumgizmo/dgvalidator.cc b/drumgizmo/dgvalidator.cc
index d0cef8d..d7557aa 100644
--- a/drumgizmo/dgvalidator.cc
+++ b/drumgizmo/dgvalidator.cc
@@ -34,8 +34,32 @@
#include <string>
#include <hugin.hpp>
+void printUsage(const char* prog, bool full = true)
+{
+ printf("Usage: %s <drumkit>|-h|--help\n", prog);
+ if(!full)
+ {
+ return;
+ }
+ printf("Validates the xml and semantics of the drumkit file and prints "
+ "any found errors to the console.\n");
+ printf("Returns 0 on success or 1 if errors were found.\n");
+}
+
int main(int argc, char* argv[])
{
+ if(argc != 2)
+ {
+ printUsage(argv[0], false);
+ return 1;
+ }
+
+ if(std::string(argv[1]) == "-h" || std::string(argv[1]) == "--help")
+ {
+ printUsage(argv[0]);
+ return 1;
+ }
+
std::string edited_filename = argv[1];
DrumkitDOM drumkitdom;
std::vector<InstrumentDOM> instrumentdoms;
@@ -86,5 +110,20 @@ int main(int argc, char* argv[])
return 1;
}
- return 0;
+ // Verify all referred audiofiles
+ for(const auto& instrument: kit.instruments)
+ {
+ for(auto& audiofile: instrument->audiofiles)
+ {
+ audiofile->load(1);
+ if(!audiofile->isLoaded())
+ {
+ WARN(drumkitloader, "Instrument file load error: '%s'",
+ audiofile->filename.data());
+ parseerror = true;
+ }
+ }
+ }
+
+ return parseerror ? 1 : 0;
}
diff --git a/man/dgvalidator.1 b/man/dgvalidator.1
new file mode 100644
index 0000000..dde1358
--- /dev/null
+++ b/man/dgvalidator.1
@@ -0,0 +1,36 @@
+.TH "DGVALIDATOR" "1" "29 June 2019" "dgvalidator" ""
+
+.SH NAME
+dgvalidator \- drumgizmo drumkit validator
+
+.SH SYNOPSIS
+\fBdgvalidator\fR <drumkitfile>|-h|--help
+
+.SH "DESCRIPTION"
+.PP
+\fBDgvalidator\fR is a simple validator tool for drumgizmo drumkit files.
+.PP
+Dgvalidator will try to load the drumkit pointed to by drumkitfile and
+validate it. It validates both the xml in the drumkit and all instrument files
+referred in it as well as the the semantics of the contents -
+including checking for the existance and validity of all audiofiles
+referred by the instruments.
+
+.SH "OPTIONS"
+.PD 0
+.RE
+\fB-h, --help\fR
+.RS 7
+Print command line help and exit.
+
+.RE
+\fBdrumkitfile\fR
+.RS 7
+The drumkitfile to verify.
+
+.RE
+.SH "BUGS"
+Report bugs to http://www.drumgizmo.org/wiki/doku.php?id=bugs.
+
+.SH "ADDITIONAL INFORMATION"
+For further information, visit the website http://www.drumgizmo.org.