本文整理汇总了C++中ofxOscMessage类的典型用法代码示例。如果您正苦于以下问题:C++ ofxOscMessage类的具体用法?C++ ofxOscMessage怎么用?C++ ofxOscMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ofxOscMessage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: generateMessage
void Mesh::generateMessage(ofxOscMessage& message) {
message.setAddress("/mesh/positions");
for (auto p : points) {
message.addFloatArg(p.x);
message.addFloatArg(p.y);
}
}
开发者ID:YosukeM,项目名称:Turbulence,代码行数:7,代码来源:Mesh.cpp
示例2: 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 << ".";
}
开发者ID:gnastacast,项目名称:exquisite_donut,代码行数:36,代码来源:donut_cop.cpp
示例3: 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);
}
}
开发者ID:miquelsoler,项目名称:ConductrEnter,代码行数:26,代码来源:AbletonManager.cpp
示例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);
}
}
开发者ID:miquelsoler,项目名称:ConductrEnter,代码行数:28,代码来源:AbletonManager.cpp
示例5: 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);
}
}
开发者ID:decebel,项目名称:OF-tools,代码行数:32,代码来源:AbletonLiveSet.cpp
示例6: addOscMessageArg
void addOscMessageArg(ofxOscMessage& message,
const ofFloatColor& value) {
message.addFloatArg(value.r);
message.addFloatArg(value.g);
message.addFloatArg(value.b);
message.addFloatArg(value.a);
}
开发者ID:t3kt,项目名称:memory,代码行数:7,代码来源:OscController.cpp
示例7: 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));
}
}
}
开发者ID:ndonald2,项目名称:drawAndFade,代码行数:29,代码来源:ofApplication.cpp
示例8:
//--------------------------------------------------------------
void ofApp::getMessage22(ofxOscMessage m){
int msgnum;
msgnum = m.getNumArgs();
if(msgnum==2){
velx_ave = m.getArgAsInt32(0);
vely_ave = m.getArgAsInt32(1);
}
}
开发者ID:hawkshaw,项目名称:bapa_screen_master,代码行数:9,代码来源:ofApp.cpp
示例9: 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;
}
开发者ID:toruyokoyama,项目名称:ofxMultiTaction,代码行数:8,代码来源:ofxMultiTaction.cpp
示例10: 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);
}
}
开发者ID:decebel,项目名称:OF-tools,代码行数:8,代码来源:AbletonLiveSet.cpp
示例11: oscSendCenter
void oniActorApp::oscSendCenter(XnPoint3D center, string addr, ofxOscMessage &m)
{
m.setAddress(addr);
m.addFloatArg(center.X);
m.addFloatArg(center.Y);
m.addFloatArg(center.Z);
sender.sendMessage(m);
m.clear();
}
开发者ID:RecipientCollective,项目名称:KinActor_project,代码行数:9,代码来源:oniActorAppUtils.cpp
示例12: getAverageFromChannels
//--------------------------------------------------------------
float ofApp::getAverageFromChannels(ofxOscMessage& msg) {
float avg = 0;
int channels = msg.getNumArgs();
for(int i = 0; i < channels; i++) {
avg += msg.getArgAsFloat(i);
}
avg /= channels;
return avg;
}
开发者ID:Pratik155,项目名称:CC_SYD_02_EEG,代码行数:11,代码来源:ofApp.cpp
示例13: getHighestFromChannels
float ofApp::getHighestFromChannels(ofxOscMessage& msg) {
float highest = 0;
int channels = msg.getNumArgs();
for(int i = 0; i < channels; i++) {
float channelValue = msg.getArgAsFloat(i);
if(channelValue > highest) highest = channelValue;
}
return highest;
}
开发者ID:Pratik155,项目名称:CC_SYD_02_EEG,代码行数:10,代码来源:ofApp.cpp
示例14: 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;
}
开发者ID:toruyokoyama,项目名称:ofxMultiTaction,代码行数:10,代码来源:ofxMultiTaction.cpp
示例15: 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();
}
开发者ID:imclab,项目名称:SoundPainter,代码行数:27,代码来源:testApp.cpp
示例16: 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;
}
}
开发者ID:moonmilk,项目名称:BklynBalletVisualization,代码行数:11,代码来源:DelaunayVisualization.cpp
示例17: getOscMessageValue
ofVec3f getOscMessageValue(const ofxOscMessage& message) {
auto size = message.getNumArgs();
if (size == 3) {
return ofVec3f(message.getArgAsFloat(0),
message.getArgAsFloat(1),
message.getArgAsFloat(2));
} else {
logInvalidSize(message);
return ofVec3f(0);
}
}
开发者ID:t3kt,项目名称:memory,代码行数:11,代码来源:OscController.cpp
示例18: 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));
}
}
开发者ID:22736389,项目名称:wekinator_examples,代码行数:12,代码来源:AbletonGui.cpp
示例19: 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);
}
开发者ID:t3kt,项目名称:memory,代码行数:12,代码来源:OscController.cpp
示例20: appendParameter
void ofxOscSender::appendParameter( ofxOscMessage & msg, const ofAbstractParameter & parameter, string address){
msg.setAddress(address+parameter.getEscapedName());
if(parameter.type()==typeid(ofParameter<int>).name()){
msg.addIntArg(parameter.cast<int>());
}else if(parameter.type()==typeid(ofParameter<float>).name()){
msg.addFloatArg(parameter.cast<float>());
}else if(parameter.type()==typeid(ofParameter<bool>).name()){
msg.addIntArg(parameter.cast<bool>());
}else{
msg.addStringArg(parameter.toString());
}
}
开发者ID:CLOUDS-Interactive-Documentary,项目名称:openFrameworks,代码行数:12,代码来源:ofxOscSender.cpp
注:本文中的ofxOscMessage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论