//-------------------------------------------------------------------------- template<> void FaustNode<double>::sendOSC() const { if (OSCControler::gXmit != kNoXmit && !OSCControler::isPathFiltered(getOSCAddress())) { std::vector<std::string> aliases = fRoot->getAliases(getOSCAddress()); // If aliases are present if (aliases.size() > 0) { for (size_t i = 0; i < aliases.size(); i++) { oscout << OSCStart(aliases[i].c_str()) << double(*fZone) << OSCEnd(); } } // Also emit regular address if (OSCControler::gXmit == kAll) { oscout << OSCStart(getOSCAddress().c_str()) << double(*fZone) << OSCEnd(); } } }
//-------------------------------------------------------------------------- template<> void FaustNode<double>::get(unsigned long ipdest) const ///< handler for the 'get' message { unsigned long savedip = oscout.getAddress(); // saves the current destination IP oscout.setAddress(ipdest); // sets the osc stream dest IP // send a state message on 'get' request oscout << OSCStart(getOSCAddress().c_str()) << double(*fZone) << double(fMapping.fMinOut) << double(fMapping.fMaxOut) << OSCEnd(); oscout.setAddress(savedip); // and restores the destination IP }
//-------------------------------------------------------------------------- void OSCIO::send(int nframes, float* val, int chan) const { std::stringstream dst; dst << dest() << chan; // first set the destination osc address std::string res = dst.str(); oscout << OSCStart(res.c_str()); // then starts the osc out stream for (int n = 0; n < nframes; n++) { oscout << val[n]; // and send the values } oscout << OSCEnd(); // end of stream (and actual transmission) }
//-------------------------------------------------------------------------- // start the network services void OSCControler::run () { SRootNode rootnode = fFactory->root(); // first get the root node if (rootnode) { // informs the root node of the udp ports numbers (required to handle the 'hello' message rootnode->setPorts (&fUDPPort, &fUDPOut, &fUPDErr); // starts the network services fOsc->start (rootnode, fUDPPort, fUDPOut, fUPDErr, getDestAddress()); // and outputs a message on the osc output port oscout << OSCStart("Faust OSC version") << versionstr() << "-" << quote(rootnode->getName()).c_str() << "is running on UDP ports " << fUDPPort << fUDPOut << fUPDErr; // and also on the standard output cout << "Faust OSC version " << versionstr() << " application " << quote(rootnode->getName()).c_str() << " is running on UDP ports " << fUDPPort << ", " << fUDPOut << ", " << fUPDErr << endl; if (fIO) oscout << " using OSC IO - in chans: " << fIO->numInputs() << " out chans: " << fIO->numOutputs(); oscout << OSCEnd(); } }
//-------------------------------------------------------------------------- void Message::print(OSCStream& out) const { out << OSCStart(address().c_str()); printArgs(out); out << OSCEnd(); }