### ExternalSender.cs - OSC Motion Data Sender Source: https://github.com/gpsnmeajp/easyvirtualmotioncaptureforunity/wiki/Home This C# script is an example of an external sender for OSC motion data. It is part of the Virtual Motion Capture project. ```csharp using UnityEngine; using System.Collections; using System.Collections.Generic; using System.Text; using System; public class ExternalSender : MonoBehaviour { public string remoteHost = "127.0.0.1"; public int remotePort = 3939; public string localHost = "127.0.0.1"; public int localPort = 3838; private Osc.OscClient client; private Osc.OscServer server; void Start() { client = new Osc.OscClient(remoteHost, remotePort); server = new Osc.OscServer(localPort); server.PacketReceived += OnPacketReceived; } void OnPacketReceived(Osc.OscPacket packet) { // Handle received OSC packets here Debug.Log("Received OSC packet: " + packet.ToString()); } void Update() { // Example: Send a simple OSC message if (Input.GetKeyDown(KeyCode.Space)) { client.Send("/test/message", 1.0f, "hello"); } } void OnDestroy() { if (server != null) { server.PacketReceived -= OnPacketReceived; server.Dispose(); } if (client != null) { client.Dispose(); } } } ``` -------------------------------- ### Key Input Event Callback Source: https://github.com/gpsnmeajp/easyvirtualmotioncaptureforunity/wiki/InputReceiver.cs Use this to send keyboard input as an event. Add a listener to KeyInputAction to receive KeyInput events. ```csharp public void KeyInputEvent(EVMC4U.KeyInput key){} ``` -------------------------------- ### MIDI Note Input Event Callback Source: https://github.com/gpsnmeajp/easyvirtualmotioncaptureforunity/wiki/InputReceiver.cs Use this to send MIDI note input as an event. Add a listener to MidiNoteInputAction to receive MidiNote events. ```csharp public void MidiNoteEvent(EVMC4U.MidiNote note){} ``` -------------------------------- ### Controller Input Event Callback Source: https://github.com/gpsnmeajp/easyvirtualmotioncaptureforunity/wiki/InputReceiver.cs Use this to send controller input as an event. Add a listener to ControllerInputAction to receive ControllerInput events. ```csharp public void ControllerInputEvent(EVMC4U.ControllerInput con){} ``` -------------------------------- ### MIDI CC Value Input Event Callback Source: https://github.com/gpsnmeajp/easyvirtualmotioncaptureforunity/wiki/InputReceiver.cs Use this to send MIDI CC input (analog values) as an event. Add a listener to MidiCCValueInputAction to receive MidiCCValue events. ```csharp public void MidiCCValEvent(EVMC4U.MidiCCValue val){} ``` -------------------------------- ### MIDI CC Button Input Event Callback Source: https://github.com/gpsnmeajp/easyvirtualmotioncaptureforunity/wiki/InputReceiver.cs Use this to send MIDI CC input (digital values) as an event. Only sends changes. Add a listener to MidiCCButtonInputAction to receive MidiCCButton events. ```csharp public void MidiCCButtonEvent(EVMC4U.MidiCCButton bit){} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.