3 Copyright (C) 2011 Grame
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.
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.
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
19 Grame Research Laboratory, 9 rue du Garet, 69001 Lyon - France
24 #include "FaustNode.h"
26 #include "OSCStream.h"
31 //--------------------------------------------------------------------------
32 bool FaustNode::store( float val
)
34 *fZone
= fMapping
.scale(val
);
38 //--------------------------------------------------------------------------
39 bool FaustNode::accept( const Message
* msg
)
41 if (msg
->size() == 1) { // checks for the message parameters count
42 // messages with a param count other than 1 are rejected
44 if (msg
->param(0, fval
)) return store (fval
); // accepts float values
45 else if (msg
->param(0, ival
)) return store (float(ival
)); // but accepts also int values
47 return MessageDriven::accept(msg
);
51 //--------------------------------------------------------------------------
52 void FaustNode::get (unsigned long ipdest
) const
54 unsigned long savedip
= oscout
.getAddress(); // saves the current destination IP
55 oscout
.setAddress(ipdest
); // sets the osc stream dest IP
56 // send a state message on 'get' request
57 oscout
<< OSCStart(getOSCAddress().c_str()) << *fZone
<< fMapping
.fMinOut
<< fMapping
.fMaxOut
<< OSCEnd();
58 oscout
.setAddress(savedip
); // and restores the destination IP