public static void InitialSettings() { faderPage = 1; EncoderMenuPosition = 1; BigEncoderOption = BigEncoderButtonFunctionMidiValue.straightenAngle; ActivePanel = ActivePanel.loupe; SendToMidiDevice.Send("Encoder"); Display.Send(1, "High. ", "Tone "); Display.Send(2, "Lights ", "Tone "); Display.Send(3, "Darks ", "Tone "); Display.Send(4, "Shadow ", "Tone "); Display.Send(5, "Shadow ", "Split "); Display.Send(6, "Midtone", "Split "); Display.Send(7, "High. ", "Split "); Display.Send(8, " ", " "); LrParameters.BigEncoderDisplayButtons(); SendToMidiDevice.MidiSend(ChannelCommand.NoteOn, 0, 95, 0); SendToMidiDevice.MidiSend(ChannelCommand.NoteOn, 0, 80, 0); SendToMidiDevice.MidiSend(ChannelCommand.NoteOn, 0, 81, 0); SendToMidiDevice.MidiSend(ChannelCommand.NoteOn, 0, 82, 0); SendToMidiDevice.MidiSend(ChannelCommand.NoteOn, 0, 83, 0); }
public static void Start() { var x = Sanford.Multimedia.Midi.InputDevice.DeviceCount; for (int i = 0; i < x; i++) { var b = InputDevice.GetDeviceCapabilities(i); Console.WriteLine("ID: " + i + " Driver version: " + b.driverVersion + " Mid: " + b.mid + " name: " + b.name + " pid: " + b.pid + " Support: " + b.support); } InputDevice inDevice = new InputDevice(0); //ChannelStopper stopper = new ChannelStopper(); inDevice.ChannelMessageReceived += delegate(object sender, ChannelMessageEventArgs e) { //stopper.Process(e.Message); //Console.WriteLine(e.Message.Bytes[0] + "." + e.Message.Bytes[1] + "." + e.Message.Bytes[2]); byte b0 = e.Message.Bytes[0]; byte b1 = e.Message.Bytes[1]; byte b2 = e.Message.Bytes[2]; LrParameters.SetParameterByMidi(b0, b1, b2); }; inDevice.StartRecording(); }
static void Main(string[] args) { Display.Start(); LrParameters.Start(); GlobalSettings.InitialSettings(); Thread socketThread = new Thread(Sockets.StartClient); socketThread.Start(); Thread midiSendingThread = new Thread(SendToMidiDevice.ThreadSendingMidi); midiSendingThread.Start(); Sockets.StartUploadClient(); MidiIn.Start(); Console.Read(); }
public static void StartClient() { // Data buffer for incoming data. byte[] bytes = new byte[1024]; // Connect to a remote device. // Establish the remote endpoint for the socket. // This example uses port 11000 on the local computer. string LocalHostName = Dns.GetHostName(); IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName()); IPAddress ipAddress = IPAddress.Parse("127.0.0.1"); IPEndPoint remoteEP = new IPEndPoint(ipAddress, 51761); // Create a TCP/IP socket. Socket sender = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); // Connect the socket to the remote endpoint. Catch any errors. sender.Connect(remoteEP); Console.WriteLine("Socket connected to {0}", sender.RemoteEndPoint.ToString()); // Encode the data string into a byte array. //byte[] msg = Encoding.ASCII.GetBytes("select = next /n"); // Send the data through the socket. //int bytesSent = sender.Send(msg); while (true) { int bytesRec = sender.Receive(bytes); //Console.WriteLine("Echoed test = {0}", Encoding.ASCII.GetString(bytes, 0, bytesRec)); //Console.WriteLine("=================================================="); //Console.WriteLine(Encoding.ASCII.GetString(bytes, 0, bytesRec)); var str = Encoding.ASCII.GetString(bytes, 0, bytesRec); str = str.Replace("\r", ""); str = str.Replace("\n", ""); str = str.Replace("\t", ""); str = str.Replace("\0", ""); str = str.Replace("\"", ""); str = str.Replace("}", ""); GlobalSettings.strSplit = str.ToString().Split('{'); if (GlobalSettings.strSplit != null) { LrParameters.SetParameters(GlobalSettings.strSplit); } } // Receive the response from the remote device. // Release the socket. // sender.Shutdown(SocketShutdown.Both); //sender.Close(); //catch (ArgumentNullException ane) //{ // Console.WriteLine("ArgumentNullException : {0}", ane.ToString()); //} //catch (SocketException se) //{ // Console.WriteLine("SocketException : {0}", se.ToString()); //} //catch (Exception e) //{ // Console.WriteLine("Unexpected exception : {0}", e.ToString()); //} //catch (Exception e) //{ // Console.WriteLine(e.ToString()); //} }