本文整理汇总了C++中ofxOscMessage::getArgAsInt32方法的典型用法代码示例。如果您正苦于以下问题:C++ ofxOscMessage::getArgAsInt32方法的具体用法?C++ ofxOscMessage::getArgAsInt32怎么用?C++ ofxOscMessage::getArgAsInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofxOscMessage
的用法示例。
在下文中一共展示了ofxOscMessage::getArgAsInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleControlMessage
//--------------------------------------------------------------
void DonutCop::handleControlMessage(const ofxOscMessage &m) {
ofBuffer data = m.getArgAsBlob(0);
_maxSprinkles = m.getArgAsInt32(1);
_minSprinkles = m.getArgAsInt32(2);
_maxNewSprinkles = m.getArgAsInt32(3);
_maxVelocity = m.getArgAsFloat(4);
_maxAcceleration = m.getArgAsFloat(5);
// Calculate left and right IDs
int val;
int maxId = 0;
leftId = 256;
rightId = -1;
for (int i = 0; i < data.size(); ++i) {
val = (int)(data.getData()[i]);
if (val > id && val < leftId) {
leftId = val;
}
if (val < id && val > rightId) {
rightId = val;
}
if (val > maxId) {
maxId = val;
}
}
if (leftId == 256) {
leftId = 0;
}
if (rightId == -1) {
rightId = maxId;
}
ofLogVerbose() << "My left ID is " << leftId << " and my right ID is " << rightId << ".";
}
示例2: 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;
}
示例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: onTracksVolumeChanged
///--------------------------------------------------------------
void AbletonManager::onTracksVolumeChanged(ofxOscMessage &m)
{
/**
* Response for track volume (amplitude) changes:
* /live/track/meterblock
* N triplets with:
* (int) track number
* (int) channel (0=left, 1=right)
* (float) volume (0..1)
*/
int track, channel;
float volume;
int numArgs = m.getNumArgs();
for (int i=0; i<numArgs; i+=3)
{
track = m.getArgAsInt32(i);
channel = m.getArgAsInt32(i+1);
volume = m.getArgAsFloat(i+2);
if (channel == 1) continue; // Skip right channel messages
if (track >= sceneNumObjects) continue; // Skip if this track index is larger than the number of objects in scene
ofNotifyEvent(eventsVolumeChanged[track], volume, this);
}
}
示例5: getDeviceParametersRange
void Ableton::getDeviceParametersRange(ofxOscMessage &m)
{
int track = m.getArgAsInt32(0);
int device = m.getArgAsInt32(1);
if (tracks.count(track) != 0 && tracks[track]->getDevices().count(device) != 0) {
tracks[track]->getDevices()[device]->getParameterRanges(m);
}
}
示例6: makeMarkerFromOSC
static ofMultiTaction::Marker makeMarkerFromOSC(const ofxOscMessage &m)
{
ofMultiTaction::Marker marker;
marker.id = m.getArgAsInt32(0);
marker.code = m.getArgAsInt32(1);
marker.x = m.getArgAsFloat(2);
marker.y = m.getArgAsFloat(3);
marker.rotation = m.getArgAsFloat(3);
return marker;
}
示例7: getParameterUpdate
void Ableton::getParameterUpdate(ofxOscMessage &m)
{
int track = m.getArgAsInt32(0);
int device = m.getArgAsInt32(1);
int parameter = m.getArgAsInt32(2);
if (tracks.count(track) != 0 &&
tracks[track]->getDevices().count(device) != 0 &&
tracks[track]->getDevices()[device]->getParameters().count(parameter))
{
tracks[track]->getDevices()[device]->getParameters()[parameter]->setValue(m.getArgAsFloat(3));
}
}
示例8: getNumTracks
void Ableton::getNumTracks(ofxOscMessage &m)
{
numTracks = m.getArgAsInt32(0);
for (int t = 0; t < numTracks; t++) {
requestDeviceList(t);
}
}
示例9: 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)));
}
}
示例10: 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();
}
示例11: 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();
}
示例12: onClipPlayingPositionChanged
///--------------------------------------------------------------
void AbletonManager::onClipPlayingPositionChanged(ofxOscMessage &m)
{
/**
* Response for clip position changes:
* /clip/playing_position
* N triplets with:
* (int) track
* (int) clip
* (float) track position (0..1)
*/
int track;
float position;
int numArgs = m.getNumArgs();
for (int i=0; i<numArgs; i+=3)
{
track = m.getArgAsInt32(i);
// clip = m.getArgAsInt32(i+1);
position = m.getArgAsFloat(i+2);
if (track >= sceneNumObjects) continue;
ofNotifyEvent(eventsClipPositionChanged[track], position, this);
}
}
示例13: getNumScenes
void Ableton::getNumScenes(ofxOscMessage &m)
{
numScenes = m.getArgAsInt32(0);
// sceneSelector = control.addMenu("Select scene", this, &Ableton::eventSelectScene);
for (int i=0; i<numScenes; i++) {
//sceneSelector->addToggle("Scene "+ofToString(i));
}
}
示例14:
//--------------------------------------------------------------
void ofApp::getMessage22(ofxOscMessage m){
int msgnum;
msgnum = m.getNumArgs();
if(msgnum==2){
velx_ave = m.getArgAsInt32(0);
vely_ave = m.getArgAsInt32(1);
}
}
示例15: makeFingerFromOSC
static ofMultiTaction::Finger makeFingerFromOSC(const ofxOscMessage &m)
{
ofMultiTaction::Finger finger;
finger.id = m.getArgAsInt32(0);
finger.x = m.getArgAsFloat(1);
finger.y = m.getArgAsFloat(2);
return finger;
}