本文整理汇总了C#中OscMessage类的典型用法代码示例。如果您正苦于以下问题:C# OscMessage类的具体用法?C# OscMessage怎么用?C# OscMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OscMessage类属于命名空间,在下文中一共展示了OscMessage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Broadcast
private void Broadcast(OscMessage message)
{
foreach (var oscSender in this.oscSenders)
{
oscSender.Send(message);
}
}
开发者ID:greenbaum,项目名称:KinectV2-OSC,代码行数:7,代码来源:BodySender.cs
示例2: WiiMoteOscMsgHandler
public void WiiMoteOscMsgHandler(OscMessage oscMeg)
{
//Debug.Log (oscMeg.Address);
ArrayList values = oscMeg.Values;
string[] strings;
if (!initialFlag)
initialFlag = true;
for (int i = 0; i < values.Count; i++) {
strings = values[i].ToString().Split(':');
Debug.Log (i + ": "+ values[i]);
if(int.Parse(strings[1]) == 1)
ir_state[i] = true;
else
ir_state[i] = false;
string[] positionStrings = strings[2].Split(',');
float positionX = float.Parse(positionStrings[0]);
float positionY = float.Parse(positionStrings[1]);
ir_position[i] = new Vector2(positionX,positionY);
WiiVRUpdate();
}
}
开发者ID:gary9716,项目名称:HeadTrackingProject,代码行数:30,代码来源:TestOscClient.cs
示例3: OSCCallback
public void OSCCallback(OscMessage m)
{
if (verbose) {
string command = (string) m.Values[0];
string osc_report_string = "";
//print("OSC command is " + command);
for (int i = 0; i < m.Values.Count; i++) {
osc_report_string = osc_report_string + "Values[" + i + "]: " + m.Values[i] + "***";
}
//print("osc_report_string: " + osc_report_string + "\n");
}
oscMessagesToSend.Add(m);
//obsolete code, but we do need to figure out how to better handle MIDI notes,
//or if we should even handle them at all (and instead only use CC)
/*
if(command == "midievent") {
midiEventReceiver((string)m.Values[1], (int)m.Values[2], (int)m.Values[3]);
}
else if (command == "scenechange") {
if (verbose) {
Debug.Log("SCENE CHANGE!!!!!!!!!");
}
sceneChange = (int) m.Values[1];
}
else if (command == "cc") {
//string messageName = "onCC";
}
*/
}
开发者ID:corybarr,项目名称:Unearthed,代码行数:33,代码来源:OSCCommunicator.cs
示例4: AllMessageHandler
public void AllMessageHandler(OscMessage message){
Debug.Log(message);
Debug.Log("stuff sent");
string msgAddress = message.Address; //the message parameters
string msgString = Osc.OscMessageToString(message); //the message and value combined
float myValue = (float)message.Values[0];
int iValue = Mathf.RoundToInt(myValue);
yRot = iValue;
Debug.Log(msgAddress);
//FUNCTIONS YOU WANT CALLED WHEN A SPECIFIC MESSAGE IS RECEIVED
switch (msgAddress){
case "/1/push1":
xRot = iValue;
break;
case "/1/push2":
yRot = iValue;
break;
case "/1/push3":
zRot = iValue;
break;
case "/1/fader1":
scaleVal = 1+iValue;
break;
default:
//
break;
}
}
开发者ID:bitchwhocodes,项目名称:ITP_Storytelling,代码行数:34,代码来源:OSCReceiver2.cs
示例5: CreateTestBundle
private static OscBundle CreateTestBundle()
{
IPEndPoint sourceEndPoint = new IPEndPoint(IPAddress.Loopback, Port);
OscBundle bundle = new OscBundle(sourceEndPoint);
OscBundle nestedBundle = new OscBundle(sourceEndPoint);
OscMessage nestedMessage = new OscMessage(sourceEndPoint, TestMethod);
nestedMessage.AppendNil();
nestedMessage.Append("Some String");
nestedMessage.Append(10);
nestedMessage.Append(100000L);
nestedMessage.Append(1234.567f);
nestedMessage.Append(10.0012345);
nestedMessage.Append(new byte[] { 1, 2, 3, 4 });
nestedMessage.Append(new OscTimeTag());
nestedMessage.Append('c');
nestedMessage.Append(Color.DarkGoldenrod);
nestedMessage.Append(true);
nestedMessage.Append(false);
nestedMessage.Append(float.PositiveInfinity);
nestedBundle.Append(nestedMessage);
bundle.Append(nestedBundle);
OscMessage message = new OscMessage(sourceEndPoint, AliveMethod);
message.Append(9876.543f);
bundle.Append(message);
return bundle;
}
开发者ID:MugenSAS,项目名称:osc-.net,代码行数:29,代码来源:Program.cs
示例6: ReceiveMessage
protected override void ReceiveMessage(OscMessage message)
{
// Debug.Log(message);
/* // addresses must be listed in Inspector/Osc Addresses
if (message.Address.Equals("/vicon/Position0"))
{
var v = new Vector3((float)(double)message[0], (float)(double)message[2] - 1, (float)(double)message[1]);
playerController.transform.localPosition = v;
}
else if (message.Address.Equals("/vicon/Quaternion0"))
{
//var q = new Quaternion((float)(double)message[0], (float)(double)message[1], (float)(double)message[2], (float)(double)message[3]);
}
else*/ if (message.Address.Equals("/niw/client/aggregator/floorcontact"))
{
// Floor input
int id = (int)message[1];
float x = (((float)message[2]) / 6.0f);
float z = (((float)message[3]) / 6.0f);
var position = new Vector3(x, 0, z);
Debug.Log(position);
RacketObject.GetComponent<Racket>().SendMessage("SetPosition", new Vector3(0, 0, x));
}
}
开发者ID:Naiko90,项目名称:Pong,代码行数:27,代码来源:NiwController.cs
示例7: BuildBeatMessage
private void BuildBeatMessage(int[][] score, OscMessage m)
{
for (var trackCount = 0; trackCount < numberOfTracks; trackCount++)
{
BuildTrackMessage(score, m, trackCount);
}
}
开发者ID:robbell,项目名称:compose-collide,代码行数:7,代码来源:Playback.cs
示例8: MessageHandler
// called every time Unity receives a message
public void MessageHandler(OscMessage message)
{
// string msgString = Osc.OscMessageToString(message);
//MainDebug.WriteLine(msgString); // writing out the message to see if everything works correctly
//Debug.Log (msgString);
// clean debug message
string debugLine = "received for adress : ";
debugLine += message.Address + " with values : ";
int j = 0;
foreach (object o in message.Values) {
debugLine += o.ToString () + ", ";
OSCvalues [j] = float.Parse (message.Values [j].ToString ());
j++;
}
Debug.Log (debugLine);
if (message.Address == "/gain"){
float gain = float.Parse(message.Values[0].ToString());
colorCorrect.gain = Mathf.Pow (10,(gain*2));
}
if (message.Address == "/gamma"){
float gamma = float.Parse(message.Values[0].ToString());
colorCorrect.gamma = 1/(gamma*2);
}
if (message.Address == "/black"){
colorCorrect.black = float.Parse(message.Values[0].ToString());
}
}
开发者ID:leon196,项目名称:UnityVJ,代码行数:33,代码来源:OSCReceiverC.cs
示例9: Update
void Update()
{
// If we are going to send 'as bundle', then we would like OSC io
// to add the timetag to the messeges contained in the bundle.
oscIn.addTimeTagsToBundledMessages = sendAsBundle;
// Create a messege
OscMessage message = new OscMessage( address );
// Create a timetag. Default time is DateTime.Now.
OscTimeTag timetag = new OscTimeTag();
// Make it 1 milisecond into the future.
timetag.time = timetag.time.AddMilliseconds( 1 );
// Two possible methods for sending timetags ...
if( sendAsBundle )
{
// Either create a bundle with the timetag, add the message and send.
OscBundle bundle = new OscBundle( timetag );
bundle.Add( message );
oscOut.Send( bundle );
} else {
// Or add the timetag to message and send it.
message.Add( timetag );
oscOut.Send( message );
}
// Update label.
sendLabel.text = timetag.time + ":" + timetag.time.Millisecond;
}
开发者ID:ahsquared,项目名称:BigEyesInstallation,代码行数:31,代码来源:UsingTimeTags.cs
示例10: AllMessageHandler
public void AllMessageHandler(OscMessage oscMessage) {
string msg = Osc.OscMessageToString (oscMessage).Substring (1);
string[] _vals = msg.Split (' ');
float[] vals = new float[_vals.Length];
for (int i = 0; i < vals.Length; i++)
vals[i] = float.Parse(_vals[i]);
}
开发者ID:patricio272,项目名称:VoxelVR,代码行数:7,代码来源:OSCReceiver.cs
示例11: OSCMessageReceiver
public override void OSCMessageReceiver(OscMessage message)
{
if (emit) {
emitter.Emit();
}
Debug.Log("Message...");
}
开发者ID:corybarr,项目名称:Unearthed,代码行数:8,代码来源:OSCTwitterListener.cs
示例12: SendMessage
private void SendMessage(Action<OscMessage> appendAction)
{
var message = new OscMessage(endPoint, "/");
appendAction(message);
message.Send(endPoint);
}
开发者ID:robbell,项目名称:drum-score,代码行数:8,代码来源:OscOutput.cs
示例13: Send
public void Send(OscMessage msg)
{
if (m_SendController != null)
{
// Send the message
m_SendController.Sender.Send(msg);
}
}
开发者ID:Naiko90,项目名称:Pong,代码行数:8,代码来源:SendOscBehaviourBase.cs
示例14: MetaHandler
public void MetaHandler(OscMessage oscMessage)
{
library.step = (int)oscMessage.Values[0];
library.numSteps = (int)oscMessage.Values[1];
int numPatterns = (int)oscMessage.Values[2];
library.SetNumPatterns(numPatterns);
Debug.Log("Meta found");
}
开发者ID:mattsonic,项目名称:GateTriggerUnity,代码行数:8,代码来源:AppOSC.cs
示例15: OnMessageReceived
void OnMessageReceived( OscMessage message )
{
// Get the time tag.
OscTimeTag timeTag;
if( !message.TryGet( 0, out timeTag ) ) return;
// Update label.
receiveLabel.text = timeTag.time + ":" + timeTag.time.Millisecond;
}
开发者ID:ahsquared,项目名称:BigEyesInstallation,代码行数:9,代码来源:UsingTimeTags.cs
示例16: OnMessageReceived
void OnMessageReceived( OscMessage message )
{
// Get the value
float value;
if( !message.TryGet( 0, out value ) ) return;
// Update label
receiveLabel.text = value.ToString();
}
开发者ID:ahsquared,项目名称:BigEyesInstallation,代码行数:9,代码来源:UsingBroadcast.cs
示例17: OSCMessageReceiver
public override void OSCMessageReceiver(OscMessage message)
{
float x = System.Convert.ToInt32(message.Values[2]) / 127.0f;
//print(x);
renderer.material.color = new Color(System.Convert.ToInt32(message.Values[2]) / 127.0f,
renderer.material.color.g,
renderer.material.color.b,
renderer.material.color.a);
}
开发者ID:CodeStrumpet,项目名称:Elemental,代码行数:9,代码来源:OSCColorChanger.cs
示例18: Ta_filler0
void Ta_filler0(OscMessage oscMessage)
{
for( int i = 0; i <= 5; i++) {
trackarray[i] = (float)oscMessage.Values[i];
//Debug.Log("htrack : "+(float)oscMessage.Values[i]);
}
}
开发者ID:robertofazio,项目名称:Earthquakes-first-prototype,代码行数:9,代码来源:OSCListener.cs
示例19: OSCMessageReceiver
public override void OSCMessageReceiver(OscMessage message)
{
float x = System.Convert.ToInt32(message.Values[2]) / 127.0f;
x *= 25;
if (x > 0) {
pe.maxSize = x;
pe.minSize = x;
pe.Emit();
}
}
开发者ID:CodeStrumpet,项目名称:Elemental,代码行数:10,代码来源:ParticleEmit.cs
示例20: OscMessageToString
public static string OscMessageToString(OscMessage message)
{
StringBuilder s = new StringBuilder();
s.Append(message.Address);
foreach(object o in message.Values) {
s.Append(" ");
s.Append(o.ToString());
}
return s.ToString();
}
开发者ID:rgerd,项目名称:TunnelVision,代码行数:10,代码来源:Osc.cs
注:本文中的OscMessage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论