Example #1
0
        private void ReadRouteRecord(MidiConfigurationsSchema record, Routes midiRoutes)
        {
            midiRoutes.ResetRoutes();

            for (int n = 0; n < record.InPorts.Count; n++)
            {
                // check if the input is available now
                int inport = midiRoutes.FindInputPort(record.InPorts[n]);
                if (inport >= 0)
                {
                    if (record.Routes.Count > 0)
                    {
                        foreach (int m in record.Routes[n])
                        {
                            int outport = midiRoutes.FindOutputPort(record.OutPorts[m]);
                            if (outport >= 0)
                            {
                                midiRoutes.AddRoute(inport, outport);
                            }
                            else
                            {
                                Console.WriteLine("Could not find outport {0} in current midi setup.", record.OutPorts[m]);
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine("No routes in configuration");
                    }
                }
                else
                {
                    Console.WriteLine("Unalble to load configuration because {0} doesn't exist in current MIDI setup.", record.InPorts[n]);
                }
            }

            // Configure UDP ports
            int i = 0;

            foreach (int inport in record.UdpPorts)
            {
                foreach (int op in record.UdpRoutes[i])
                {
                    int outport = midiRoutes.FindOutputPort(record.OutPorts[op]);
                    if (outport >= 0)
                    {
                        midiRoutes.AddRoute(inport, outport);
                    }
                    else
                    {
                        Console.WriteLine("Could not find outport {0} in current midi setup.", record.OutPorts[i]);
                    }
                }
                i++;
            }
        }
Example #2
0
        public void ReadRouteConfig(string Name, Routes midiRoutes)
        {
            MidiConfigurationsSchema record = Configurations.Find(r => r.ConfigurationName == Name);

            if (record != null)
            {
                ReadRouteRecord(record, midiRoutes);
            }
            else
            {
                Console.WriteLine("Unable to find config {0}", Name);
            }
        }
Example #3
0
        internal bool ConfigExists(string Name)
        {
            MidiConfigurationsSchema record = Configurations.Find(r => r.ConfigurationName == Name);

            if (record == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #4
0
        public void ReadRouteConfigDefault(Routes midiRoutes)
        {
            MidiConfigurationsSchema record = Configurations.Find(r => r.ConfigurationName == rms.DefaultConfig);

            if (record != null)
            {
                ReadRouteRecord(record, midiRoutes);
            }
            else
            {
                Console.WriteLine("Unable to find config {0}", rms.DefaultConfig);
            }
        }
Example #5
0
        public void WriteRouteConfig(string Name, Routes midiRoutes)
        {
            if (midiRoutes.Count <= 0)
            {
                Console.WriteLine("Can't save configuration with out routes defined.");
                return;
            }

            MidiConfigurationsSchema record = Configurations.Find(r => r.ConfigurationName == Name);

            if (record == null)
            {
                record = new MidiConfigurationsSchema();
                record.ConfigurationName = Name;
                Configurations.Add(record);
            }

            for (int n = 0; n < InputMidi.Count; n++)
            {
                record.InPorts.Add(midiRoutes.GetInportName(n));
            }

            for (int n = 0; n < OutputMidi.Count; n++)
            {
                record.OutPorts.Add(midiRoutes.GetOutportName(n));
            }

            for (int n = 0; n < InputMidi.Count; n++)
            {
                record.Routes.Add(midiRoutes.GetRoute(n));
            }

            foreach (UDPMidiPort ump in midiRoutes.midiPortList.list)
            {
                List <int> opl = new List <int>();
                foreach (OutputMidi o in ump.oml)
                {
                    opl.Add(midiRoutes.FindOutputPort(o.Name));
                }

                record.UdpPorts.Add(ump.UDPInPort);
                record.UdpRoutes.Add(opl);
            }
        }
Example #6
0
 public void ReadRouteConfigByNumber(int number, Routes midiRoutes)
 {
     if (number < Configurations.Count && number >= 1)
     {
         MidiConfigurationsSchema record = Configurations[number - 1];
         if (record != null)
         {
             ReadRouteRecord(record, midiRoutes);
         }
         else
         {
             Console.WriteLine("Unable to find config number {0}", number);
         }
     }
     else
     {
         Console.WriteLine("Configuraiton number out of range");
     }
 }
Example #7
0
        internal void ReadDefaultConfig(Routes midiRoutes)
        {
            MidiConfigurationsSchema record = Configurations[0];

            ReadRouteRecord(record, midiRoutes);
        }