2023-08-16 19:47:14 +02:00
|
|
|
/*
|
|
|
|
godotVmcSharp
|
|
|
|
Copyright (C) 2023 Cassandra de la Cruz-Munoz
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as published
|
|
|
|
by the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Net;
|
|
|
|
using Godot;
|
|
|
|
using godotOscSharp;
|
|
|
|
|
|
|
|
namespace godotVmcSharp
|
|
|
|
{
|
|
|
|
public class Performer
|
|
|
|
{
|
|
|
|
private godotOscSharp.OscReceiver receiver;
|
|
|
|
private godotOscSharp.OscSender sender;
|
|
|
|
public Performer(IPAddress host, int port)
|
|
|
|
{
|
|
|
|
receiver = new godotOscSharp.OscReceiver(port);
|
|
|
|
sender = new godotOscSharp.OscSender(host, port);
|
|
|
|
receiver.MessageReceived += (sender, e) =>
|
|
|
|
{
|
|
|
|
GD.Print($"Received a message from {e.IPAddress}:{e.Port}");
|
|
|
|
ProcessMessage(e.Message);
|
|
|
|
};
|
|
|
|
receiver.ErrorReceived += (sender, e) =>
|
|
|
|
{
|
|
|
|
GD.Print($"Error: {e.ErrorMessage}");
|
|
|
|
};
|
|
|
|
}
|
|
|
|
private void ProcessMessage(godotOscSharp.OscMessage m)
|
|
|
|
{
|
|
|
|
switch (m.Address.ToString())
|
|
|
|
{
|
2023-08-16 21:28:13 +02:00
|
|
|
case "/VMC/Ext/Hmd/Pos":
|
|
|
|
new VmcExtDevicePos(m);
|
|
|
|
break;
|
|
|
|
case "/VMC/Ext/Con/Pos":
|
|
|
|
new VmcExtDevicePos(m);
|
|
|
|
break;
|
|
|
|
case "/VMC/Ext/Tra/Pos":
|
|
|
|
new VmcExtDevicePos(m);
|
|
|
|
break;
|
2023-08-16 21:36:02 +02:00
|
|
|
case "/VMC/Ext/Set/Period":
|
|
|
|
new VmcExtSetPeriod(m);
|
|
|
|
break;
|
2023-08-16 21:28:13 +02:00
|
|
|
case "/VMC/Ext/Midi/CC/Val":
|
|
|
|
new VmcExtMidiCcVal(m);
|
|
|
|
break;
|
|
|
|
case "/VMC/Ext/Cam":
|
|
|
|
new VmcExtCam(m);
|
|
|
|
break;
|
2023-08-16 19:47:14 +02:00
|
|
|
case "/VMC/Ext/Blend/Val":
|
|
|
|
new VmcExtBlendVal(m);
|
|
|
|
break;
|
|
|
|
case "/VMC/Ext/Blend/Apply":
|
|
|
|
new VmcMessage(m.Address);
|
|
|
|
break;
|
2023-08-17 00:43:51 +02:00
|
|
|
case "/VMC/Ext/Set/Eye":
|
|
|
|
new VmcExtSetEye(m);
|
|
|
|
break;
|
2023-08-17 00:45:07 +02:00
|
|
|
case "/VMC/Ext/Set/Req":
|
|
|
|
new VmcMessage(m.Address);
|
|
|
|
break;
|
2023-08-17 00:47:33 +02:00
|
|
|
case "/VMC/Ext/Set/Res":
|
|
|
|
new VmcExtSetRes(m);
|
|
|
|
break;
|
2023-08-17 00:51:21 +02:00
|
|
|
case "/VMC/Ext/Set/Calib/Ready":
|
|
|
|
new VmcMessage(m.Address);
|
|
|
|
break;
|
|
|
|
case "/VMC/Ext/Set/Calib/Exec":
|
|
|
|
new VmcExtSetCalibExec(m);
|
|
|
|
break;
|
2023-08-17 00:53:12 +02:00
|
|
|
case "/VMC/Ext/Set/Config":
|
|
|
|
new VmcExtSetConfig(m);
|
|
|
|
break;
|
2023-08-16 20:35:37 +02:00
|
|
|
case "/VMC/Ext/Light":
|
|
|
|
new VmcExtLight(m);
|
|
|
|
break;
|
2023-08-17 00:55:02 +02:00
|
|
|
case "/VMC/Ext/Set/Shortcut":
|
|
|
|
new VmcExtSetShortcut(m);
|
|
|
|
break;
|
2023-08-16 19:47:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|