Exemplo n.º 1
0
        private void Dispatch_BusReceivedEvent(object sender, BusReceivedEventArgs e)
        {
            //TODO Dispatch channel
            Debug.WriteLine("received bus...");
            string[] subs = e.subAddress.Split('/');
            switch (subs[1])
            {
            case "config":
            case "mix":
                MixBusses[e.bus - 1].SetValuesFromOSC(subs, e.value);
                break;

            case "dyn":
                MixBusses[e.bus - 1].m_Dynamic.SetValuesFromOSC(subs, e.value);
                break;

            case "insert":
                break;

            case "eq":
                MixBusses[e.bus - 1].m_Eq.SetValuesFromOSC(subs, e.value);
                break;

            case "grp":
                break;
            }
        }
Exemplo n.º 2
0
        private void OnBusReceivedEvent(BusReceivedEventArgs e)
        {
            BusReceivedEventHandler handler = BusReceivedEvent;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        public void UpdateFromUI(Constants.COMPONENT_TYPE type, int channel, object newValue, string address)
        {
            switch (type)
            {
            case Constants.COMPONENT_TYPE.CHANNEL:
                ChannelReceivedEventArgs args = new ChannelReceivedEventArgs();
                args.channel    = channel;
                args.value      = newValue;
                args.subAddress = address;
                args.fromLocal  = true;
                OnChannelReceivedEvent(args);
                break;

            case Constants.COMPONENT_TYPE.AUX_INPUT:
                AuxinReceivedEventArgs auxArgs = new AuxinReceivedEventArgs();
                auxArgs.channel    = channel;
                auxArgs.value      = newValue;
                auxArgs.subAddress = address;
                auxArgs.fromLocal  = true;
                OnAuxinReceivedEvent(auxArgs);
                break;

            case Constants.COMPONENT_TYPE.FXRETURN:
                FXReturnReceivedEventArgs fxArgs = new FXReturnReceivedEventArgs();
                fxArgs.channel    = channel;
                fxArgs.value      = newValue;
                fxArgs.subAddress = address;
                fxArgs.fromLocal  = true;
                OnFXReturnReceivedEvent(fxArgs);
                break;

            case Constants.COMPONENT_TYPE.MIX_BUS:
                BusReceivedEventArgs busArgs = new BusReceivedEventArgs();
                busArgs.bus        = channel;
                busArgs.value      = newValue;
                busArgs.subAddress = address;
                busArgs.fromLocal  = true;
                OnBusReceivedEvent(busArgs);
                break;

            case Constants.COMPONENT_TYPE.MATRIX:
                MatrixReceivedEventArgs matrixArgs = new MatrixReceivedEventArgs();
                matrixArgs.matrix     = channel;
                matrixArgs.value      = newValue;
                matrixArgs.subAddress = address;
                matrixArgs.fromLocal  = true;
                OnMatrixReceivedEvent(matrixArgs);
                break;

            case Constants.COMPONENT_TYPE.MAIN:
                MainOutReceivedEventArgs mainArgs = new MainOutReceivedEventArgs();
                mainArgs.mainout    = channel;
                mainArgs.value      = newValue;
                mainArgs.subAddress = address;
                mainArgs.fromLocal  = true;
                OnMainOutReceivedEvent(mainArgs);
                break;

            case Constants.COMPONENT_TYPE.DCA:
                DCAReceivedEventArgs dcaArgs = new DCAReceivedEventArgs();
                dcaArgs.dca        = channel;
                dcaArgs.value      = newValue;
                dcaArgs.subAddress = address;
                dcaArgs.fromLocal  = true;
                OnDCAReceivedEvent(dcaArgs);
                break;

            default:
                break;
            }
        }