zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit e10d74a7780263747c4340a78c1286b453cd4785
parent b63fc32b21ef33f2aed72f7ecf356a644ffd2cef
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Thu, 11 May 2017 14:53:57 -0400

Add Defaults To Schema

Diffstat:
Msrc/Misc/Schema.cpp | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/Misc/Schema.cpp b/src/Misc/Schema.cpp @@ -25,6 +25,8 @@ namespace zyn { * - 'scale' : scale-type * - 'domain' : range [OPTIONAL] * - 'options' : [option...] [OPTIONAL] + * - 'default' : string + * - 'defaults' : defaults * type : {'int', 'float', 'boolean'} * action : * - 'path' : path-id @@ -35,6 +37,9 @@ namespace zyn { * option : * - 'id' : id-number * - 'value' : string-rep + * defaults : + * - 'id' : id-number + * - 'value' : string-rep */ using std::ostream; @@ -175,6 +180,7 @@ void dump_param_cb(const rtosc::Port *p, const char *full_name, const char*, const char *min = meta["min"]; const char *max = meta["max"]; + const char *def = meta["default"]; for(auto m:meta) { if(strlen(m.title) >= 5 && !memcmp(m.title, "map ", 4)) { @@ -202,6 +208,8 @@ void dump_param_cb(const rtosc::Port *p, const char *full_name, const char*, o << " \"type\" : \"" << type << "\""; if(min && max) o << ",\n \"range\" : [" << min << "," << max << "]"; + if(def) + o << ",\n \"default\" : \"" << def << "\"\n"; if(!options.empty()) { o << ",\n \"options\" : [\n"; int N = options.size();