1 /*
2
3 Copyright (C) 2012 Grame
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Grame Research Laboratory, 9 rue du Garet, 69001 Lyon - France
20 research@grame.fr
21
22 */
23
24 #include "jsonfaustui.h"
25 #include "jsonui.h"
26
27 namespace httpdfaust
28 {
29
jsonfaustui(const char * name,const char * address,int port)30 jsonfaustui::jsonfaustui(const char *name, const char* address, int port)
31 {
32 fJSON = new jsonui<FAUSTFLOAT>(name, address, port);
33 }
34
~jsonfaustui()35 jsonfaustui::~jsonfaustui() { delete fJSON; }
36
37 //--------------------------------------------
38 // UI methods
39 //--------------------------------------------
40 // -- widget's layouts
openTabBox(const char * label)41 void jsonfaustui::openTabBox(const char* label) { fJSON->openTabBox(label); }
openHorizontalBox(const char * label)42 void jsonfaustui::openHorizontalBox(const char* label) { fJSON->openHorizontalBox(label); }
openVerticalBox(const char * label)43 void jsonfaustui::openVerticalBox(const char* label) { fJSON->openVerticalBox(label); }
closeBox()44 void jsonfaustui::closeBox() { fJSON->closeBox(); }
45
46 // -- active widgets
addButton(const char * label,FAUSTFLOAT * zone)47 void jsonfaustui::addButton(const char* label, FAUSTFLOAT* zone) { fJSON->addButton(label, zone); }
addCheckButton(const char * label,FAUSTFLOAT * zone)48 void jsonfaustui::addCheckButton(const char* label, FAUSTFLOAT* zone) { fJSON->addCheckButton(label, zone); }
49
addVerticalSlider(const char * label,FAUSTFLOAT * zone,FAUSTFLOAT init,FAUSTFLOAT min,FAUSTFLOAT max,FAUSTFLOAT step)50 void jsonfaustui::addVerticalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
51 { fJSON->addVerticalSlider(label, zone, init, min, max, step); }
52
addHorizontalSlider(const char * label,FAUSTFLOAT * zone,FAUSTFLOAT init,FAUSTFLOAT min,FAUSTFLOAT max,FAUSTFLOAT step)53 void jsonfaustui::addHorizontalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
54 { fJSON->addHorizontalSlider(label, zone, init, min, max, step); }
55
addNumEntry(const char * label,FAUSTFLOAT * zone,FAUSTFLOAT init,FAUSTFLOAT min,FAUSTFLOAT max,FAUSTFLOAT step)56 void jsonfaustui::addNumEntry(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
57 { fJSON->addNumEntry(label, zone, init, min, max, step); }
58
59 // -- passive widgets
addHorizontalBargraph(const char * label,FAUSTFLOAT * zone,FAUSTFLOAT min,FAUSTFLOAT max)60 void jsonfaustui::addHorizontalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
61 { fJSON->addHorizontalBargraph(label, zone, min, max); }
addVerticalBargraph(const char * label,FAUSTFLOAT * zone,float min,float max)62 void jsonfaustui::addVerticalBargraph(const char* label, FAUSTFLOAT* zone, float min, float max)
63 { fJSON->addVerticalBargraph(label, zone, min, max); }
64
65 // -- metadata declarations
declare(FAUSTFLOAT * zone,const char * key,const char * val)66 void jsonfaustui::declare(FAUSTFLOAT* zone, const char* key, const char* val) { fJSON->declare(zone, key, val); }
67
68 //--------------------------------------------
69 // additionnal methods (not part of UI)
70 //--------------------------------------------
numInput(int n)71 void jsonfaustui::numInput(int n) { fJSON->numInput(n);}
numOutput(int n)72 void jsonfaustui::numOutput(int n) { fJSON->numOutput(n);}
declare(const char * key,const char * val)73 void jsonfaustui::declare(const char* key, const char* val) { fJSON->declare(key, val); }
74
json(bool flatten)75 std::string jsonfaustui::json(bool flatten) { return fJSON->json(flatten); }
76
77 } //end namespace
78
79