commit 06cc0bbaaaea54133c3d4df6404f5603c85f2516
parent cb5933ef0012320bd561253f1b8a47e532f9c987
Author: fundamental <mark.d.mccurry@gmail.com>
Date: Wed, 31 Aug 2016 21:52:00 -0400
Apply Microtonal Settings When Loading XML
Diffstat:
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/src/Misc/Microtonal.cpp b/src/Misc/Microtonal.cpp
@@ -3,6 +3,7 @@
Microtonal.cpp - Tuning settings and microtonal capabilities
Copyright (C) 2002-2005 Nasca Octavian Paul
+ Copyright (C) 2016 Mark McCurry
Author: Nasca Octavian Paul
This program is free software; you can redistribute it and/or
@@ -790,6 +791,7 @@ void Microtonal::getfromXML(XMLwrapper& xml)
}
xml.exitbranch();
}
+ apply();
}
@@ -819,3 +821,34 @@ int Microtonal::loadXML(const char *filename)
return 0;
}
+
+//roundabout function, but it works
+void Microtonal::apply(void)
+{
+ {
+ char buf[100*MAX_OCTAVE_SIZE] = {0};
+ char tmpbuf[100] = {0};
+ for (int i=0;i<Pmapsize;i++) {
+ if (i!=0)
+ strncat(buf, "\n", sizeof(buf)-1);
+ if (Pmapping[i]==-1)
+ snprintf(tmpbuf,100,"x");
+ else
+ snprintf(tmpbuf,100,"%d",Pmapping[i]);
+ strncat(buf, tmpbuf, sizeof(buf)-1);
+ }
+ texttomapping(buf);
+ }
+
+ {
+ char buf[100*MAX_OCTAVE_SIZE] = {0};
+ char tmpbuf[100] = {0};
+ for (int i=0;i<getoctavesize();i++){
+ if (i!=0)
+ strncat(buf, "\n", sizeof(buf)-1);
+ tuningtoline(i,tmpbuf,100);
+ strncat(buf, tmpbuf, sizeof(buf)-1);
+ }
+ int err = texttotunings(buf);
+ }
+}
diff --git a/src/Misc/Microtonal.h b/src/Misc/Microtonal.h
@@ -149,6 +149,7 @@ class Microtonal
//Grab a 0..127 integer from the provided descriptor
static int linetotunings(struct OctaveTuning &tune, const char *line);
+ void apply(void);
const int& gzip_compression;
};