本文整理汇总了C++中ofxOscMessage::getAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ ofxOscMessage::getAddress方法的具体用法?C++ ofxOscMessage::getAddress怎么用?C++ ofxOscMessage::getAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofxOscMessage
的用法示例。
在下文中一共展示了ofxOscMessage::getAddress方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleTouchPadMessage
void ofApplication::handleTouchPadMessage(ofxOscMessage &m)
{
string a = m.getAddress();
int a_len = a.length();
int r_len = string("/oF/multiPad/").length();
if (a_len > r_len)
{
string mRouteStr = a.substr(r_len, a_len-r_len);
int touchIndex = atoi(&mRouteStr.at(0));
int delim_pos = mRouteStr.find("/");
if (delim_pos != string::npos)
{
// z-message
if (mRouteStr.at(mRouteStr.length()-1) == 'z')
{
bool on = m.getArgAsFloat(0) != 0.0;
if (!on){
touchMap.erase(touchIndex);
}
}
}
else
{
// x-y are swapped in touchOSC landscape
touchMap[touchIndex] = ofVec2f(m.getArgAsFloat(1), m.getArgAsFloat(0));
}
}
}
示例2: setOscDebugMessage
void testApp::setOscDebugMessage(ofxOscMessage message)
{
std::stringstream stream;
stream << "OSC messages";
if (!showOscDebugPosition)
{
stream << " (Not showing position messages)";
}
stream << " :\n";
stream << "[address]: " << message.getAddress() << ", ";
for (int i = 0; i < message.getNumArgs(); ++i) {
stream << "[" << (i+1) << "]: ";
if (message.getArgType(i) == OFXOSC_TYPE_INT32) {
stream << message.getArgAsInt32(i);
}
else if (message.getArgType(i) == OFXOSC_TYPE_STRING) {
stream << message.getArgAsString(i);
}
else if (message.getArgType(i) == OFXOSC_TYPE_FLOAT) {
stream << message.getArgAsFloat(i);
}
if (i != message.getNumArgs()-1) {stream << ", ";};
}
stream << ", time: ";
stream << ofGetElapsedTimef();
m_debugMessage = stream.str();
}
示例3: handleOscMessage
void FluidVisualization::handleOscMessage(ofxOscMessage m){
string address = m.getAddress();
const string fluidColorHS = "/showrunner/fluid/colorhs";
const string fluidColorB = "/showrunner/fluid/colorb";
const string fluidInk = "/showrunner/fluid/ink";
const string fluidFlame = "/showrunner/fluid/flame";
const string fluidForce = "/showrunner/fluid/force";
const string fluidReset = "/showrunner/fluid/reset";
if(address == fluidFlame){
flame=(m.getArgAsFloat(0) == 1);
}else if(address == fluidInk){
ink=(m.getArgAsFloat(0) == 1);
}else if(address == fluidForce){
force=(m.getArgAsFloat(0) == 1);
}else if(address == fluidReset){
if (m.getArgAsFloat(0) == 1){
fluidSolver.reset();
}
}else if(address == fluidColorHS){
colorH=m.getArgAsFloat(0)*255;
colorS=m.getArgAsFloat(1)*255;
}else if(address == fluidColorB){
colorB= m.getArgAsFloat(0)*255;
}
}
示例4: handleMessage
bool tuioVisBase::handleMessage(ofxOscMessage m) {
string address = m.getAddress();
// special cases first:
if (address=="/tuio/2dcur" && m.getNumArgs()==7 && m.getArgType(0)==OFXOSC_TYPE_STRING && m.getArgAsString(0)=="set") {
tuioCursor tc;
tc.s = m.getArgAsInt32(1);
tc.x = m.getArgAsFloat(2);
tc.y = m.getArgAsFloat(3);
tc.dx = m.getArgAsFloat(4);
tc.dy = m.getArgAsFloat(5);
tc.m = m.getArgAsFloat(6);
tc.age = 0;
return cursorCallback(tc);
}
else if (address=="/tuio/2Dcur" && m.getNumArgs()==2 && m.getArgType(0)==OFXOSC_TYPE_STRING && m.getArgAsString(0)=="fseq") {
return frameCallback(m.getArgAsInt32(1));
}
else if (linearCallbacks.find(address) != linearCallbacks.end() && m.getNumArgs()==1) {
return linearCallback(address, m.getArgAsFloat(0));
}
else if (colorCallbacks.find(address) != colorCallbacks.end() && m.getNumArgs()==3) {
return colorCallback(address, m.getArgAsFloat(0), m.getArgAsFloat(1), m.getArgAsFloat(2));
}
// message not handled:
else return false;
}
示例5: handleMessageAsCommand
bool OscController::handleMessageAsCommand(const ofxOscMessage &message) {
auto address = message.getAddress();
const auto& prefix = _params.commandPrefix.get();
if (address.find(prefix) == std::string::npos) {
return false;
}
auto name = address.substr(prefix.size());
auto args = messageToCommandArgs(message);
return _commands.perform(name, args);
}
示例6: handleMessage
void OscController::handleMessage(const ofxOscMessage &message) {
if (handleMessageAsCommand(message)) {
return;
}
auto iter = _bindings.find(message.getAddress());
if (iter == _bindings.end()) {
return;
}
iter->second->handleMessage(message);
}
示例7: handleOscMessage
void DelaunayVisualization::handleOscMessage(ofxOscMessage m){
string address = m.getAddress();
const string delaunayColorHS = "/showrunner/delaunay/colorhs";
const string delaunayColorB = "/showrunner/delaunay/colorb";
if(address == delaunayColorHS){
colorH=m.getArgAsFloat(0)*255;
colorS=m.getArgAsFloat(1)*255;
}else if(address == delaunayColorB){
colorB= m.getArgAsFloat(0)*255;
}
}
示例8: oscReceiveTouchOscChanges
//----------
void OscManager::oscReceiveTouchOscChanges(ofxOscMessage &msg) {
vector<string> m = ofSplitString(msg.getAddress(), "/");
if (m.size()>1 && m[m.size()-1].length()==1 && ofToInt(m[m.size()-1])>0) {
int idx = ofToInt(m[m.size()-1]);
m.pop_back();
string address = ofJoinString(m, "/");
if (inputTrackers.count(address) > 0) {
oscReceiveProcessTouchOscMessage(address, msg, idx);
}
}
}
示例9: sendMessage
void OscController::sendMessage(ofxOscMessage message) {
if (_receiving) {
return;
}
if (!_sender) {
ofLogWarning() << "Unable to send osc message " << message.getAddress() << ", sender not initialized";
return;
}
message.setRemoteEndpoint(_params.outputHost.get(),
_params.outputPort.get());
_sender->sendMessage(message, false);
}
示例10: sendMessage
void ofApp::sendMessage(ofxOscMessage &m) {
// here we iterate through the registered clients, sending the heartbeat message to them all.
for(map<string, ofxOscSender>::iterator i = clients.begin(); i != clients.end(); i++) {
// iterator->first = key (string ip)
// iterator->second = value (ofxOscSender sender)
ofxOscSender & _sender = i->second;
cout << "sending " << m.getAddress() << " to " << i->first << endl;
_sender.sendMessage(m);
}
}
示例11: parseMessage
void AbletonGui::parseMessage(ofxOscMessage & msg)
{
string address = msg.getAddress();
if (address == addressRoot) {
for (int idx = 0; idx < min((int)sliders.size(), msg.getNumArgs()); idx++) {
sliders[idx]->setValue(msg.getArgAsFloat(idx));
}
}
else if (activeAddresses.count(address) >0) {
activeAddresses[address]->setValue(msg.getArgAsFloat(0));
}
}
示例12: handleMessage
//-------------------------------------------------------------
void ofApp::handleMessage(ofxOscMessage m) {
string send_string;
string address_string;
string ip_string;
ip_string = "/" + ofSplitString( ofToString(m.getRemoteIp()), ".")[3];
// check for battery message
if(m.getAddress() == "/battery"){
if(m.getArgType(0) == OFXOSC_TYPE_FLOAT){
// construct OSC message to send
sendBattery( ip_string, m.getArgAsFloat(0));
}
}
// check for blob message
else if(m.getAddress() == "/inputs/serial/1") {
for(int i = 0; i < m.getNumArgs(); i++){
// get the argument type
if(m.getArgType(i) == OFXOSC_TYPE_BLOB){
string blob = m.getArgAsBlob(0);
vector<string> parameters = ofSplitString(blob, ",");
if( parameters.size() >= 5 ) {
int distance = ofToInt(parameters[0]);
int velocity = ofToInt(parameters[1]);
int azimuth = ofToInt(parameters[2]);
int elevation = ofToInt(parameters[3]);
float angularRate = ofToFloat(parameters[4]);
// send osc messages
sendDistance(ip_string, distance);
sendVelocity(ip_string, velocity);
sendAzimuth(ip_string, azimuth);
sendElevation(ip_string, elevation);
sendAngularRate(ip_string, angularRate);
}
}
}
}
}
示例13: dumpOSC
string messenger::dumpOSC(ofxOscMessage m) {
string msg_string;
msg_string = m.getAddress();
for (int i=0; i<m.getNumArgs(); i++ ) {
msg_string += " ";
if(m.getArgType(i) == OFXOSC_TYPE_INT32)
msg_string += ofToString( m.getArgAsInt32(i));
else if(m.getArgType(i) == OFXOSC_TYPE_FLOAT)
msg_string += ofToString( m.getArgAsFloat(i));
else if(m.getArgType(i) == OFXOSC_TYPE_STRING)
msg_string += m.getArgAsString(i);
}
return msg_string;
}
示例14: dumpOSC
void ofApp::dumpOSC(ofxOscMessage m) {
string msgString;
msgString = m.getAddress();
for (int i=0; i<m.getNumArgs(); i++){
msgString += " ";
if(m.getArgType(i) == OFXOSC_TYPE_INT32)
msgString += ofToString(m.getArgAsInt32(i));
else if(m.getArgType(i) == OFXOSC_TYPE_FLOAT)
msgString += ofToString(m.getArgAsFloat(i));
else if(m.getArgType(i) == OFXOSC_TYPE_STRING)
msgString += m.getArgAsString(i);
}
cout << msgString << endl;
}
示例15: parseOSC
void AnimatedSinus::parseOSC(ofxOscMessage &m){
// string msg = m.getAddress();
// string cmd ;
//
// int ces = msg.find_first_of("/");
//
// if (ces != -1) {
// if (ces == 0){
// msg = msg.substr(ces+1);
// cmd = msg;
// ces = msg.find_first_of("/");
// if (ces != -1) {
// cmd = msg.substr(0, ces);
// msg = msg.substr(ces);
// }
// }
// else{
// cmd = msg.substr(0, ces);
// msg = msg.substr(ces);
// }
// }
vector<string> osc = getOSCcmd(m.getAddress());
string cmd = osc[0];
string msg = osc[1];
if (cmd == "sin"){
osc = getOSCcmd(msg);
string cmd = osc[0];
string msg = osc[1];
if (cmd == "freq"){
freq = ofMap(m.getArgAsFloat(0), 0., 1., 0., 500.);
}
else if (cmd == "nbPoint"){
nbPoint = m.getArgAsInt32(0);
}
else if (cmd == "speed"){
speed = ofMap(m.getArgAsFloat(0), 0., 1., 0., 50.);
}
else if (cmd == "height"){
height = m.getArgAsFloat(0);
}
else if (cmd == "posY"){
posY = ofMap(m.getArgAsFloat(0), 0., 1., -1., 1.);
}
}
}