本文整理汇总了C++中ofxOscMessage::getArgAsString方法的典型用法代码示例。如果您正苦于以下问题:C++ ofxOscMessage::getArgAsString方法的具体用法?C++ ofxOscMessage::getArgAsString怎么用?C++ ofxOscMessage::getArgAsString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofxOscMessage
的用法示例。
在下文中一共展示了ofxOscMessage::getArgAsString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillPresetListFromMessage
void ofxRemoteUIClient::fillPresetListFromMessage(ofxOscMessage m){
int n = m.getNumArgs();
//check if server has no presets at all
if (m.getNumArgs() == 1){
if(m.getArgAsString(0) == OFXREMOTEUI_NO_PRESETS){ //if no prests, server sends only one with this value
//we know there's no presets
}
}
presetNames.clear();
for(int i = 0; i < n; i++){
presetNames.push_back( m.getArgAsString(i));
}
}
示例2: updateWithOscMessage
void ramNodeArray::updateWithOscMessage(const ofxOscMessage &m)
{
const int nNodes = m.getArgAsInt32(1);
for (int i = 0; i < nNodes; i++)
{
const string name = m.getArgAsString(i * 8 + 0 + 2);
const float vx = m.getArgAsFloat(i * 8 + 1 + 2);
const float vy = m.getArgAsFloat(i * 8 + 2 + 2);
const float vz = m.getArgAsFloat(i * 8 + 3 + 2);
const float angle = m.getArgAsFloat(i * 8 + 4 + 2);
const float ax = m.getArgAsFloat(i * 8 + 5 + 2);
const float ay = m.getArgAsFloat(i * 8 + 6 + 2);
const float az = m.getArgAsFloat(i * 8 + 7 + 2);
const ofVec3f axis(ax, ay, az);
const ofVec3f vec(vx, vy, vz);
const ofQuaternion quat(angle, axis);
ramNode &node = getNode(i);
node.node_id = i;
node.name = isActor() ? getJointName(i) : "Node " + ofToString(i);
node.setGlobalPosition(vec);
node.setGlobalOrientation(quat);
node.accelerometer.update(vec, quat);
}
last_timestamp = current_timestamp;
current_timestamp = m.getArgAsFloat(2 + nNodes * 8);
last_update_client_time = ofGetElapsedTimef();
}
示例3: getDeviceList
void Ableton::getDeviceList(ofxOscMessage &m)
{
int numArgs = m.getNumArgs();
int track = m.getArgAsInt32(0);
if (tracks.count(track) == 0)
{
AbletonTrack *newTrack = new AbletonTrack("track "+ofToString(track), track, numScenes, &sender);
tracks[track] = newTrack;
newTrack->getControl()->setCollapsible(true);
if (track == 0) {
control.attachWidget(newTrack->getControl());
}
else {
tracks[track-1]->getControl()->attachWidget(newTrack->getControl());
}
}
for (int i = 1; i < numArgs; i+=2)
{
int device = m.getArgAsInt32(i);
string name = m.getArgAsString(i+1);
if (tracks[track]->getDevices().count(device) == 0)
{
AbletonDevice *newDevice = new AbletonDevice(name, track, device, &sender);
tracks[track]->addDevice(device, newDevice);
}
requestDeviceParameters(track, device);
requestDeviceParametersRange(track, device);
}
}
示例4: 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();
}
示例5: oscReceiveProcessMessage
//----------
void OscManager::oscReceiveProcessMessage(string address, ofxOscMessage &msg) {
ParameterBase::Type type = inputTrackers[address]->getType();
if (type == ParameterBase::BOOL) {
((Parameter<bool> *) inputTrackers[address]->parameter)->set(msg.getArgAsInt32(0)==1);
}
else if (type == ParameterBase::STRING) {
((Parameter<string> *) inputTrackers[address]->parameter)->set(msg.getArgAsString(0));
}
else if (type == ParameterBase::INT) {
((Parameter<int> *) inputTrackers[address]->parameter)->set((int) msg.getArgAsFloat(0));
}
else if (type == ParameterBase::FLOAT) {
((Parameter<float> *) inputTrackers[address]->parameter)->set(msg.getArgAsFloat(0));
}
else if (type == ParameterBase::VEC2F) {
((Parameter<ofVec2f> *) inputTrackers[address]->parameter)->set(ofVec2f(msg.getArgAsFloat(0), msg.getArgAsFloat(1)));
}
else if (type == ParameterBase::VEC3F) {
((Parameter<ofVec3f> *) inputTrackers[address]->parameter)->set(ofVec3f(msg.getArgAsFloat(0), msg.getArgAsFloat(1), msg.getArgAsFloat(2)));
}
else if (type == ParameterBase::VEC4F) {
((Parameter<ofVec4f> *) inputTrackers[address]->parameter)->set(ofVec4f(msg.getArgAsFloat(0), msg.getArgAsFloat(1), msg.getArgAsFloat(2), msg.getArgAsFloat(3)));
}
}
示例6: getMsgContent
string ofApp::getMsgContent(ofxOscMessage m){
bool DISPLAY_ALL = false;
string msg_string = "";
int iTotalArg = m.getNumArgs(), i = -1;
if (DISPLAY_ALL){
msg_string += ", port: " + m.getAddress();
}
if (++i < iTotalArg && DISPLAY_ALL) msg_string += "NAME: " + m.getArgAsString(i);
if (++i < iTotalArg) msg_string += " " + m.getArgAsString(i); //STATUS
if (++i < iTotalArg) msg_string += " " + m.getArgAsString(i); //FILE
if (++i < iTotalArg && DISPLAY_ALL) msg_string += ", POSITION: " + ofToString(m.getArgAsInt(i));
if (++i < iTotalArg && DISPLAY_ALL) msg_string += ", DURATION: " + ofToString(m.getArgAsInt(i));
if (++i < iTotalArg) msg_string += ", LOOPING: " + ofToString(m.getArgAsInt(i));
if (++i < iTotalArg && DISPLAY_ALL) msg_string += ", VOLUME: " + ofToString(m.getArgAsInt(i));
if (++i < iTotalArg && DISPLAY_ALL) msg_string += ", MUTE: " + m.getArgAsString(i);
if (++i < iTotalArg && DISPLAY_ALL) msg_string += ", ZOOM: " + ofToString(m.getArgAsInt(i));
if (++i < iTotalArg && DISPLAY_ALL) msg_string += ", BLUR: " + ofToString(m.getArgAsInt(i));
return msg_string;
}
示例7: 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;
}
示例8: 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;
}
示例9: oscMsgToString
string ofApp::oscMsgToString(int num, string adr, ofxOscMessage msg) {
string res= adr;
for(int i= 0; i<num; i++) {
res= res+" ";
if(msg.getArgType(i)==OFXOSC_TYPE_INT32) {
res= res+ofToString(msg.getArgAsInt32(i));
} else if(msg.getArgType(i)==OFXOSC_TYPE_FLOAT) {
res= res+ofToString(msg.getArgAsFloat(i));
} else if(msg.getArgType(i)==OFXOSC_TYPE_STRING) {
res= res+msg.getArgAsString(i);
}
}
return res;
}
示例10: confirmMessage
void ofApp::confirmMessage(ofxOscMessage m){
//figure out which pi
string sIp = m.getRemoteIp();
string msgContent = getMsgContent(m);
int iCurPi = -1;
if (hasEnding(sIp, pi1_ip)){
iCurPi = 0;
m_bOscConfirmations[0] = true;
logMsg("got msg from 1: " + msgContent);
}
else if (hasEnding(sIp, pi2_ip)){
iCurPi = 1;
m_bOscConfirmations[1] = true;
logMsg("got msg from 2: " + msgContent);
}
else if (hasEnding(sIp, pi3_ip)){
iCurPi = 2;
m_bOscConfirmations[2] = true;
logMsg("got msg from 3: " + msgContent);
}
else if (hasEnding(sIp, pi4_ip)){
iCurPi = 3;
m_bOscConfirmations[3] = true;
logMsg("got msg from 4: " + msgContent);
} else {
logMsg("got msg from UNKNOWN " + sIp + ": " + msgContent);
}
//update corresponding status
string sCurStatus = "";
int iCurArg = 1;
string sStatus = m.getArgAsString(iCurArg++);
string sFile = m.getArgAsString(iCurArg++);
iCurArg += 2;
bool bLoop = m.getArgAsInt(iCurArg++);
if (hasEnding(sStatus, "stoped")){
sCurStatus += "Stopped";
} else {
if (bLoop){
sCurStatus += "Loop\t";
} else {
sCurStatus += "Play\t";
}
sCurStatus += sFile;
}
m_sRpiStatuses[iCurPi] = sCurStatus;
}
示例11: updateWithOscMessage
void ramActorManager::updateWithOscMessage(const ofxOscMessage &m)
{
if (isFreezed()) return;
const std::string addr = m.getAddress();
const std::string name = m.getArgAsString(0);
if (addr == RAM_OSC_ADDR_ACTOR)
{
if (!nodearrays.hasKey(name))
{
ramActor o;
o.setType(RAM_NODEARRAY_TYPE_ACTOR);
o.setName(name);
o.updateWithOscMessage(m);
nodearrays.set(name, o);
ofNotifyEvent(actorSetup, o);
}
else
{
ramActor &o = (ramActor &)nodearrays[name];
o.updateWithOscMessage(m);
}
}
else if (addr == RAM_OSC_ADDR_RIGID_BODY)
{
if (!nodearrays.hasKey(name))
{
ramRigidBody o;
o.setType(RAM_NODEARRAY_TYPE_RIGIDBODY);
o.setName(name);
o.updateWithOscMessage(m);
nodearrays.set(name, o);
ofNotifyEvent(rigidSetup, o);
}
else
{
ramRigidBody &o = (ramRigidBody &)nodearrays[name];
o.updateWithOscMessage(m);
}
}
else assert(false);
}
示例12: appendMessage
void ofxOscSender::appendMessage( ofxOscMessage& message, osc::OutboundPacketStream& p )
{
p << osc::BeginMessage( message.getAddress().c_str() );
for ( int i=0; i< message.getNumArgs(); ++i )
{
if ( message.getArgType(i) == OFXOSC_TYPE_INT32 )
p << message.getArgAsInt32( i );
else if ( message.getArgType( i ) == OFXOSC_TYPE_FLOAT )
p << message.getArgAsFloat( i );
else if ( message.getArgType( i ) == OFXOSC_TYPE_STRING )
p << message.getArgAsString( i ).c_str();
else
{
assert( false && "bad argument type" );
}
}
p << osc::EndMessage;
}
示例13: getOscMsgAsString
string ofApp::getOscMsgAsString(ofxOscMessage m){
// method from the client server ofxOsc example !
string msg_string;
msg_string ="";
for(int i = 0; i < m.getNumArgs(); i++){
// get the argument type
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: parseInfoMessage
void ofxDuration::parseInfoMessage(const ofxOscMessage& m){
ofLogVerbose("ofxDuration::parseInfoMessage") << "Received track information from Duration, #args " << m.getNumArgs();
tracks.clear();
trackNames.clear();
//pairs of two strings per track, name and type
for(int i = 0; i < m.getNumArgs()-1; i+=2){
if(m.getArgType(i ) == OFXOSC_TYPE_STRING &&
m.getArgType(i+1) == OFXOSC_TYPE_STRING)
{
string trackType = m.getArgAsString(i );
string trackName = m.getArgAsString(i+1);
ofxDurationTrack t;
t.type = trackType;
t.name = trackName;
t.lastUpdatedTime = ofGetElapsedTimef();
ofLogVerbose("ofxDuration::parseInfoMessage") << "Adding track " << t.type << " : " << t.name;
if(trackType == "Curves" || trackType == "LFO"){
//consume two more args for min and max
if(i+3 < m.getNumArgs() &&
m.getArgType(i+2) == OFXOSC_TYPE_FLOAT &&
m.getArgType(i+3) == OFXOSC_TYPE_FLOAT)
{
t.range = ofRange(m.getArgAsFloat(i+2), m.getArgAsFloat(i+3));
ofLogVerbose("ofxDuration::parseInfoMessage") << " track range is " << t.range;
i+=2;
}
}
//only add unique names
if(tracks.find(t.name) == tracks.end()){
trackNames.push_back(t.name);
tracks[t.name] = t;
}
else{
ofLogNotice("ofxDuration::parseInfoMessage") << "Duplicate track name received: " << t.name;
}
}
}
ofLogVerbose("ofxDuration::parseInfoMessage") << "Created " << tracks.size() << " tracks";
}
示例15: setParameterValue
//--------------------------------------------------------------
void oscReceiver::setParameterValue(ofAbstractParameter& param, ofxOscMessage& msg, int oscArgIndex)
{
ofAbstractParameter* p = ¶m;
if(p->type()==typeid(ofParameter<int>).name() && msg.getArgType(oscArgIndex)==OFXOSC_TYPE_INT32)
{
p->cast<int>() = msg.getArgAsInt32(oscArgIndex);
}
else if(p->type()==typeid(ofParameter<float>).name() && msg.getArgType(oscArgIndex)==OFXOSC_TYPE_FLOAT)
{
p->cast<float>() = msg.getArgAsFloat(oscArgIndex);
}else if(p->type()==typeid(ofParameter<bool>).name() && msg.getArgType(oscArgIndex)==OFXOSC_TYPE_INT32)
{
p->cast<bool>() = msg.getArgAsInt32(oscArgIndex);
}else if(msg.getArgType(oscArgIndex)==OFXOSC_TYPE_STRING)
{
p->fromString(msg.getArgAsString(oscArgIndex));
}
}