public static void Main() { // Instantiate the port Console.WriteLine("Initializing MIDI port..."); TeVirtualMIDI.logging(TeVirtualMIDI.TE_VM_LOGGING_MISC | TeVirtualMIDI.TE_VM_LOGGING_RX | TeVirtualMIDI.TE_VM_LOGGING_TX); var drawLink = new TeVirtualMIDI("C# loopback", 65535, TeVirtualMIDI.TE_VM_FLAGS_PARSE_RX, ref manufacturer, ref product); Console.WriteLine("Done!"); // Connect to Leap controller Console.WriteLine("Initializing Leap..."); Controller leapMotion = new Controller(); do { System.Threading.Thread.Sleep(1000); Console.WriteLine("."); } while (!leapMotion.IsConnected); // Allows controller to analyze frames as a background applciation leapMotion.SetPolicy(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES); bool isDrawing = true; bool wasDrawing = true; byte[] c_midC_on = { 0b10011010, 0b00111100, 0b01111111 };
// Use this for initialization void Start() { midiPort = startMidiPort(); midiThread = new Thread(new ThreadStart(SendReceiveMIDI)); midiThread.Start(); outputDevice = new OutputDevice(getMidiPortID()); }
private static void WorkThreadFunction(TeVirtualMIDI port) { while (true) { port.sendCommand(port.getCommand()); } }
static void Main(string[] args) { TeVirtualMIDI.logging(TeVirtualMIDI.TE_VM_LOGGING_MISC | TeVirtualMIDI.TE_VM_LOGGING_RX | TeVirtualMIDI.TE_VM_LOGGING_TX); //Guid manufacturer = new Guid("aa4e075f-3504-4aab-9b06-9a4104a91cf0"); //Guid product = new Guid("bb4e075f-3504-4aab-9b06-9a4104a91cf0"); //CommandReader.Initialize(new TeVirtualMIDI("C# loopback", 65535, TeVirtualMIDI.TE_VM_FLAGS_PARSE_RX, ref manufacturer, ref product)); //alernatively: simple instantiation without any "special" stuff: var port = new TeVirtualMIDI("eeee el pueeeerto"); CommandReader.Initialize(port); Thread thread = new Thread(new ThreadStart(CommandReader.WorkThreadFunction)); CommandReader.MessageReceived += CommandReader_MessageReceived; thread.Start(); Console.WriteLine("Virtual port created - press enter to close port again"); Console.ReadKey(); //CommandReader.port.shutdown(); CommandReader.ShutDown(); Console.WriteLine("Virtual port closed - press enter to terminate application"); Console.ReadKey(); }
static void Main(string[] args) { Console.WriteLine("teVirtualMIDI C# loopback sample"); Console.WriteLine("using dll-version: " + TeVirtualMIDI.versionString); Console.WriteLine("using driver-version: " + TeVirtualMIDI.driverVersionString); TeVirtualMIDI.logging(TeVirtualMIDI.TE_VM_LOGGING_MISC | TeVirtualMIDI.TE_VM_LOGGING_RX | TeVirtualMIDI.TE_VM_LOGGING_TX); Guid manufacturer = new Guid("aa4e075f-3504-4aab-9b06-9a4104a91cf0"); Guid product = new Guid("bb4e075f-3504-4aab-9b06-9a4104a91cf0"); port = new TeVirtualMIDI("C# loopback", 65535, TeVirtualMIDI.TE_VM_FLAGS_PARSE_RX, ref manufacturer, ref product); // alernatively: simple instantiation without any "special" stuff: // port = new TeVirtualMIDI( "C# loopback" ); Thread thread = new Thread(new ThreadStart(WorkThreadFunction)); thread.Start(); Console.WriteLine("Virtual port created - press enter to close port again"); Console.ReadKey(); port.shutdown(); Console.WriteLine("Virtual port closed - press enter to terminate application"); Console.ReadKey(); }
static void Redirect() { var input = "Sentive Forwarder"; _port = new TeVirtualMIDI(input); Thread thread = new Thread(RedirectorRun); thread.Start(); _outputDevice = OutputDevice.GetAll().First(t => t.Name.Contains("POP")); _outputDevice.SendEvent(new NormalSysExEvent(PDevice.BuildPianoVerifyPacket().AddTimestamp())); _outputDevice.SendEvent(new NormalSysExEvent(PDevice.BuildQueryPacket().AddTimestamp())); var inputDevice = InputDevice.GetByName(input); inputDevice.EventReceived += InputDeviceOnEventReceived; inputDevice.StartEventsListening(); //_outputDevice.EventSent += OnEventSent; DevicesConnector connector = new DevicesConnector(inputDevice, _outputDevice); connector.Connect(); System.Console.WriteLine("Running..."); System.Console.ReadLine(); inputDevice.StopEventsListening(); connector.Disconnect(); connector.Dispose(); inputDevice.Dispose(); _outputDevice.Dispose(); thread.Abort(); _port.shutdown(); System.Console.WriteLine("Stopped!"); System.Console.ReadLine(); }
public Dashboard() { this.InitializeComponent(); Log("Trying to create MIDI Interface ..."); try { this.vMIDI = new TeVirtualMIDI(vMIDIPortName); Log($"Created MIDI Interface {vMIDIPortName}"); } catch (Exception ex) { this.vMIDI = new TeVirtualMIDI(vMIDIPortName + "Duplicate"); Log($"Created MIDI Interface {vMIDIPortName + "Duplicate"}"); } Log("Trying to get own IP from http://icanhazip.com ..."); try { var externalip = new WebClient().DownloadString("http://icanhazip.com"); this.metroTextBoxPublicIP.Text = externalip; Log($"IP is: {externalip}"); } catch (Exception) { this.metroTextBoxPublicIP.Text = "Can't get IP"; Log("Failed to get IP"); } this.RefreshDevices(this, null); this.metroTextBoxPort.Text = DefaultPort.ToString(); }
// Use this for initialization void Start() { instance = this; midiVirtualDevice = startMidiPort(); midiThread = new Thread(new ThreadStart(SendReceiveMIDI)); midiThread.Start(); outputDevice = new OutputDevice(getMidiPortID()); }
public MIDIManager() { port = new TeVirtualMIDI("Udon-MIDI-Web-Helper", MIDIFrame.VRC_MAX_BYTES_PER_UPDATE, TeVirtualMIDI.TE_VM_FLAGS_PARSE_TX | TeVirtualMIDI.TE_VM_FLAGS_INSTANTIATE_TX_ONLY); for (int i = 0; i < responses.Length; i++) { responses[i] = new Queue <ConnectionResponse>(); } }
private static void reset() { if (port != null) { port.shutdown(); port = null; } asi.clearLeds(); new Thread(new ThreadStart(WorkThreadFunction)).Start(); }
public ReCommand8Midi() { TeVirtualMIDI.logging(TeVirtualMIDI.TE_VM_LOGGING_MISC | TeVirtualMIDI.TE_VM_LOGGING_RX | TeVirtualMIDI.TE_VM_LOGGING_TX); Guid manufacturer = new Guid("aa4e075f-3504-4aab-9b06-9a4104a91cf0"); Guid product = new Guid("bb4e075f-3504-4aab-9b06-9a4104a91cf0"); port = new TeVirtualMIDI("ReCommand8", 65535, TeVirtualMIDI.TE_VM_FLAGS_PARSE_RX, ref manufacturer, ref product); Thread thread = new Thread(new ThreadStart(WorkThreadFunction)); thread.Start(); }
/// <summary> /// connexion au launchpad /// </summary> /// <param name="name"></param> /// <exception cref="AlreadyConnectedMidiDevice"></exception> /// <exception cref="ErrorMidiConnexionException"></exception> public static void Connect() { _VirtualMidiPort = new TeVirtualMIDI("VirtualPort"); _msg = new ChannelMessageBuilder(); if (!connected) { try { OutDevCount = OutputDevice.DeviceCount; InDevCount = InputDevice.DeviceCount; for (int i = 0; i < OutDevCount; i++) { if (OutputDevice.GetDeviceCapabilities(i).name == midiDeviceName) { LaunchpadOutID = i; } } for (int i = 0; i < InDevCount; i++) { if (InputDevice.GetDeviceCapabilities(i).name == midiDeviceName) { LaunchpadInID = i; } } _InputLaunchPad = new InputDevice(LaunchpadInID); _InputLaunchPad.ChannelMessageReceived += HandleChannelMessageReceived; _OutputLaunchPad = new OutputDevice(LaunchpadOutID); _InputLaunchPad.StartRecording(); connected = true; } catch (Exception) { throw new ErrorMidiConnexionException(); } } else { throw new AlreadyConnectedMidiDevice(); } }
public Form1() { InitializeComponent(); small = GetIcon(ShellIconSize.SmallIcon); large = GetIcon(ShellIconSize.LargeIcon); //set normal icons SendMessage(this.Handle, WM_SETICON, SHGFI_LARGEICON, small.Handle); SendMessage(this.Handle, WM_SETICON, SHGFI_SMALLICON, large.Handle); //fully hide window but at least load it this.WindowState = FormWindowState.Minimized; this.ShowInTaskbar = false; trayMenu = new ContextMenu(); trayMenu.MenuItems.Add("Exit", trayIcon_Close); trayIcon = new NotifyIcon(); trayIcon.Text = this.Text; if (SystemInformation.SmallIconSize.Width == 16 && SystemInformation.SmallIconSize.Height == 16) //get 16x16 { trayIcon.Icon = new Icon(small, SystemInformation.SmallIconSize); } else //just calculate from base 32x32 icon to (hopefully) look better { trayIcon.Icon = new Icon(large, SystemInformation.SmallIconSize); } // Add menu to tray icon and show it. trayIcon.ContextMenu = trayMenu; trayIcon.Visible = true; trayIcon.MouseClick += trayIcon_MouseClick; devInBox.DropDownStyle = ComboBoxStyle.DropDownList; devOutBox.DropDownStyle = ComboBoxStyle.DropDownList; inDevs = new List <int>(); outDevs = new List <int>(); mahPort = new TeVirtualMIDI(pString); inPort = new MidiInPort(); outPort = new MidiOutPort(); pthrough = new Thread(new ThreadStart(readInput)); config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); inPort.Successor = new MyReceiver(); this.Load += onLoad; this.FormClosed += onClosed; this.Resize += onResize; }
public Bot() { midiController = new TeVirtualMIDI("TwitchBot"); ConnectionCredentials credentials = new ConnectionCredentials("justinfan42069", "password"); client = new TwitchClient(); client.Initialize(credentials); client.OnJoinedChannel += Client_OnJoinedChannel; client.OnLeftChannel += Client_OnLeftChannel; client.OnMessageReceived += Client_OnMessageReceived; client.Connect(); pubsub = new TwitchPubSub(); }
private TeVirtualMIDI startMidiPort() { Debug.Log("Up and running"); //LaunchMidi(); Console.WriteLine("teVirtualMIDI C# loopback sample"); Console.WriteLine("using dll-version: " + TeVirtualMIDI.versionString); Console.WriteLine("using driver-version: " + TeVirtualMIDI.driverVersionString); TeVirtualMIDI.logging(TeVirtualMIDI.TE_VM_LOGGING_MISC | TeVirtualMIDI.TE_VM_LOGGING_RX | TeVirtualMIDI.TE_VM_LOGGING_TX); Guid manufacturer = new Guid("aa4e075f-3504-4aab-9b06-9a4104a91cf0"); Guid product = new Guid("bb4e075f-3504-4aab-9b06-9a4104a91cf0"); TeVirtualMIDI port = new TeVirtualMIDI(portName, 65535, TeVirtualMIDI.TE_VM_FLAGS_PARSE_RX, ref manufacturer, ref product); Debug.Log("Midi Port started !"); return(port); }
public static void CreateMidiPort() { //Writing to Log File TeVirtualMIDI.logging(TeVirtualMIDI.TE_VM_LOGGING_MISC | TeVirtualMIDI.TE_VM_LOGGING_RX | TeVirtualMIDI.TE_VM_LOGGING_TX); Guid manufacturer = new Guid("aa4e075f-3504-4aab-9b06-9a4104a91cf0"); Guid product = new Guid("bb4e075f-3504-4aab-9b06-9a4104a91cf0"); //Create MIDI Port string portName = "BDB_MIDI"; port = new TeVirtualMIDI(portName); //Create Thread for MIDI Events Thread thread = new Thread(new ThreadStart(SendNextMidiOutMessage)); thread.Start(); }
private static void WorkThreadFunction() { byte[] command; try { port = new TeVirtualMIDI("Midi Visualizer"); Console.WriteLine("Virtual port created"); while (true) { command = port.getCommand(); asi.processMidiCommand(command); // echo command port.sendCommand(command); Console.WriteLine("command: " + byteArrayToString(command)); } } catch (Exception ex) { Console.WriteLine("thread aborting: " + ex.Message); } }
public void Send(TeVirtualMIDI port) { port.sendCommand(buffer); }
/// <summary> /// Constructeur + decouverte MIDI /// </summary> /// <exception cref="AlreadyConnectedAPC40Device" /// <exception cref="NoAPC40FoundException" public APC40() { _msg = new ChannelMessageBuilder(); //Init du builder de msg MIDI if (!connected) { Log.writeLine("Initialisation de l'APC40"); InDevCount = InputDevice.DeviceCount; Log.writeLine("Nombre de d'interface MIDI en Input détecté -> " + InDevCount); OutDevCount = OutputDevice.DeviceCount; Log.writeLine("Nombre de d'interface MIDI en Output détecté -> " + OutDevCount); #region Découverte Interfaces MIDI Log.writeLine(""); Log.writeLine("Decouverte des interfaces :"); //Interfaces d'entrées Log.writeLine("interface MIDI trouvées en entrée"); for (int i = 0; i < InDevCount; i++) { Log.writeLine(i + ">" + InputDevice.GetDeviceCapabilities(i).name); if (InputDevice.GetDeviceCapabilities(i).name == APC40Name) { APC40InID = i; } } //interfaces de sorties Log.writeLine("interface MIDI trouvées en sortie"); for (int i = 0; i < OutDevCount; i++) { Log.writeLine(i + ">" + OutputDevice.GetDeviceCapabilities(i).name); if (OutputDevice.GetDeviceCapabilities(i).name == APC40Name) { APC40OutID = i; } } if (APC40InID == -1 || APC40OutID == -1) { connected = true; close(); Log.writeLine("Aucun APC40 trouvée"); Log.writeLine("----------------------------------------------------------------------------"); Log.writeLine("----------------------------------------------------------------------------"); throw new NoAPC40FoundException(); //aucune interface trouvée } _virtualMidiPort = new TeVirtualMIDI("VirtualPort"); //Init du port virtuel #endregion } else { Log.writeLine("APC40 déja connectée"); Log.writeLine("----------------------------------------------------------------------------"); Log.writeLine("----------------------------------------------------------------------------"); throw new AlreadyConnectedAPC40Device(); //interface déja connectée } }