Merge branch 'master' of https://scm.cri.ensmp.fr/git/Faustine
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / architecture / osclib / faust / include / OSCControler.h
1 /*
2
3 Faust Project
4
5 Copyright (C) 2011 Grame
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
21 Grame Research Laboratory, 9 rue du Garet, 69001 Lyon - France
22 research@grame.fr
23
24 */
25
26 #ifndef __OSCControler__
27 #define __OSCControler__
28
29 #include <string>
30
31 namespace oscfaust
32 {
33
34 class OSCIO;
35 class OSCSetup;
36 class FaustFactory;
37
38 //--------------------------------------------------------------------------
39 /*!
40 \brief the main Faust OSC Lib API
41
42 The OSCControler is essentially a glue between the memory representation (in charge of the FaustFactory),
43 and the network services (in charge of OSCSetup).
44 */
45 class OSCControler
46 {
47 int fUDPPort, fUDPOut, fUPDErr; // the udp ports numbers
48 std::string fDestAddress; // the osc messages destination address
49 FaustFactory * fFactory; // a factory to build the memory represetnatin
50 OSCSetup* fOsc; // the network manager (handles the udp sockets)
51 OSCIO* fIO; // hack for OSC IO support (actually only relayed to the factory)
52
53 public:
54 /*
55 base udp port is chosen in an unassigned range from IANA PORT NUMBERS (last updated 2011-01-24)
56 see at http://www.iana.org/assignments/port-numbers
57 5507-5552 Unassigned
58 */
59 enum { kUDPBasePort = 5510};
60
61 OSCControler (int argc, char *argv[], OSCIO* io=0);
62 virtual ~OSCControler ();
63
64 //--------------------------------------------------------------------------
65 // addnode, opengroup and closegroup are simply relayed to the factory
66 //--------------------------------------------------------------------------
67 void addnode (const char* label, float* zone, float init, float min, float max);
68 void addfullpathnode (const std::string& fullpath, float* zone, float imin, float imax, float init, float min, float max);
69 void opengroup (const char* label);
70 void closegroup ();
71
72 //--------------------------------------------------------------------------
73 void run (); // starts the network services
74 void quit (); // stop the network services
75
76 int getUDPPort() { return fUDPPort; }
77 int getUDPOut() { return fUDPOut; }
78 int getUDPErr() { return fUPDErr; }
79 const char* getDesAddress() { return fDestAddress.c_str(); }
80 const char* getRootName(); // probably useless, introduced for UI extension experiments
81
82 static float version(); // the Faust OSC library version number
83 static const char* versionstr(); // the Faust OSC library version number as a string
84 };
85
86 }
87
88 #endif