private void OnConfigReceivedEvent(ConfigReceivedEventArgs e) { ConfigReceivedEventHandler handler = ConfigReceivedEvent; if (handler != null) { handler(this, e); } }
public void receivedOscMessage(Object sender, OSCPacketReceivedEventArgs e) { if (!goodPacket(e.packet)) { return; } if (e.packet.Address.Substring(0, 7) == "/meters") { MetersReceivedEventArgs args = new MetersReceivedEventArgs(); switch (e.packet.Address) { case "/meters/0": args.type = Constants.METER_TYPE.HOME; break; case "/meters/1": args.type = Constants.METER_TYPE.CHANNEL_PAGE; break; case "/meters/2": args.type = Constants.METER_TYPE.MIX_BUS; break; case "/meters/3": args.type = Constants.METER_TYPE.AUX_FX; break; case "/meters/4": args.type = Constants.METER_TYPE.IN_OUT; break; case "/meters/5": args.type = Constants.METER_TYPE.SURFACE; break; case "/meters/6": args.type = Constants.METER_TYPE.CHANNEL_DETAIL; break; case "/meters/7": args.type = Constants.METER_TYPE.BUS_SEND; break; case "/meters/8": args.type = Constants.METER_TYPE.MATRIX_SEND; break; case "/meters/9": args.type = Constants.METER_TYPE.EFFECTS; break; default: break; } Stream str = (Stream)e.packet.Values[0].getValue(); args.data = new byte[str.Length]; try { int i = 0; str.Position = 0; while (str.Position < str.Length) { args.data[i] = (byte)str.ReadByte(); i++; } } catch (Exception ex) { Debug.WriteLine(ex.Message); throw; } OnMetersReceivedEvent(args); } else if (e.packet.Address.Substring(0, 7) == "/config") { ConfigReceivedEventArgs args = new ConfigReceivedEventArgs(); args.subAddress = e.packet.Address.Substring(7); args.value = e.packet.Values[0].getValue(); OnConfigReceivedEvent(args); } else if (e.packet.Address.Substring(0, 3) == "/ch") { ChannelReceivedEventArgs args = new ChannelReceivedEventArgs(); string tempChannel = e.packet.Address.Substring(4, 2); args.channel = Convert.ToInt32(tempChannel); args.value = e.packet.Values[0].getValue(); args.subAddress = e.packet.Address.Substring(6); OnChannelReceivedEvent(args); } else if (e.packet.Address.Substring(0, 6) == "/auxin") { AuxinReceivedEventArgs args = new AuxinReceivedEventArgs(); string tempChannel = e.packet.Address.Substring(7, 2); args.channel = Convert.ToInt32(tempChannel); args.value = e.packet.Values[0].getValue(); args.subAddress = e.packet.Address.Substring(9); OnAuxinReceivedEvent(args); } else if (e.packet.Address.Substring(0, 6) == "/fxrtn") { FXReturnReceivedEventArgs args = new FXReturnReceivedEventArgs(); string tempChannel = e.packet.Address.Substring(7, 2); args.channel = Convert.ToInt32(tempChannel); args.value = e.packet.Values[0].getValue(); args.subAddress = e.packet.Address.Substring(9); OnFXReturnReceivedEvent(args); } else if (e.packet.Address.Substring(0, 4) == "/bus") { BusReceivedEventArgs args = new BusReceivedEventArgs(); string tempBus = e.packet.Address.Substring(5, 2); args.bus = Convert.ToInt32(tempBus); args.value = e.packet.Values[0].getValue(); args.subAddress = e.packet.Address.Substring(7); OnBusReceivedEvent(args); } else if (e.packet.Address.Substring(0, 4) == "/mtx") { MatrixReceivedEventArgs args = new MatrixReceivedEventArgs(); string tempMatrix = e.packet.Address.Substring(5, 2); args.matrix = Convert.ToInt32(tempMatrix); args.value = e.packet.Values[0].getValue(); args.subAddress = e.packet.Address.Substring(7); OnMatrixReceivedEvent(args); } else if (e.packet.Address.Substring(0, 4) == "/main/st") { MainReceivedEventArgs args = new MainReceivedEventArgs(); args.value = e.packet.Values[0].getValue(); args.subAddress = e.packet.Address.Substring(8); OnMainReceivedEvent(args); } else if (e.packet.Address.Substring(0, 4) == "/mono/st") { MonoReceivedEventArgs args = new MonoReceivedEventArgs(); args.value = e.packet.Values[0].getValue(); args.subAddress = e.packet.Address.Substring(8); OnMonoReceivedEvent(args); } else if (e.packet.Address.Substring(0, 4) == "/dca") { DCAReceivedEventArgs args = new DCAReceivedEventArgs(); string tempDCA = e.packet.Address.Substring(5, 1); args.dca = Convert.ToInt32(tempDCA); args.value = e.packet.Values[0].getValue(); args.subAddress = e.packet.Address.Substring(6); OnDCAReceivedEvent(args); } else if (e.packet.Address.Substring(0, 3) == "/fx") { EffectReceivedEventArgs args = new EffectReceivedEventArgs(); string tempEffect = e.packet.Address.Substring(4, 1); args.effect = Convert.ToInt32(tempEffect); args.value = e.packet.Values[0].getValue(); args.subAddress = e.packet.Address.Substring(5); OnEffectReceivedEvent(args); } else if (e.packet.Address.Substring(0, 8) == "/outputs") { if (e.packet.Address.Substring(8, 5) == "/main") { MainOutReceivedEventArgs args = new MainOutReceivedEventArgs(); string tempMainOut = e.packet.Address.Substring(13, 2); args.mainout = Convert.ToInt32(tempMainOut); args.value = e.packet.Values[0].getValue(); args.subAddress = e.packet.Address.Substring(15); OnMainOutReceivedEvent(args); } else if (e.packet.Address.Substring(8, 4) == "/aux") { AuxOutReceivedEventArgs args = new AuxOutReceivedEventArgs(); string tempAuxOut = e.packet.Address.Substring(12, 2); args.auxout = Convert.ToInt32(tempAuxOut); args.value = e.packet.Values[0].getValue(); args.subAddress = e.packet.Address.Substring(14); OnAuxOutReceivedEvent(args); } else if (e.packet.Address.Substring(8, 4) == "/p16") { P16OutReceivedEventArgs args = new P16OutReceivedEventArgs(); string tempP16Out = e.packet.Address.Substring(12, 2); args.p16out = Convert.ToInt32(tempP16Out); args.value = e.packet.Values[0].getValue(); args.subAddress = e.packet.Address.Substring(14); OnP16OutReceivedEvent(args); } else if (e.packet.Address.Substring(8, 4) == "/aes") { AESOutReceivedEventArgs args = new AESOutReceivedEventArgs(); string tempAESOut = e.packet.Address.Substring(12, 2); args.aesout = Convert.ToInt32(tempAESOut); args.value = e.packet.Values[0].getValue(); args.subAddress = e.packet.Address.Substring(14); OnAESOutReceivedEvent(args); } else if (e.packet.Address.Substring(8, 4) == "/rec") { RecordOutReceivedEventArgs args = new RecordOutReceivedEventArgs(); string tempRecordOut = e.packet.Address.Substring(12, 2); args.recordout = Convert.ToInt32(tempRecordOut); args.value = e.packet.Values[0].getValue(); args.subAddress = e.packet.Address.Substring(14); OnRecordOutReceivedEvent(args); } } else if (e.packet.Address.Substring(0, 8) == "/headamp") { HeadampReceivedEventArgs args = new HeadampReceivedEventArgs(); string tempHeadamp = e.packet.Address.Substring(9, 3); args.headamp = Convert.ToInt32(tempHeadamp); args.value = e.packet.Values[0].getValue(); args.subAddress = e.packet.Address.Substring(12); OnHeadampReceivedEvent(args); } }