Пример #1
0
        private void Form1_MiscTab_Load(object sender, EventArgs e)
        {
            foreach (String outputDeviceLogicalName in mapper.configuration.logicalOutputDeviceDict.Keys)
            {
                LogicalOutputDevice logicalOutputDevice = mapper.configuration.logicalOutputDeviceDict[outputDeviceLogicalName];
                if (logicalOutputDevice.device != null)
                {
                    lbOutputDevices.Items.Add(logicalOutputDevice.logicalDeviceName + " -> " + logicalOutputDevice.device.Name);
                }
            }

            lbPhysicalInputDevices.Items.Clear();
            foreach (InputDevice device in InputDevice.InstalledDevices)
            {
                lbPhysicalInputDevices.Items.Add(device.Name);
            }

            lbPhysicalOutputDevices.Items.Clear();
            foreach (OutputDevice device in OutputDevice.InstalledDevices)
            {
                lbPhysicalOutputDevices.Items.Add(device.Name);
            }

            cbPortaitMode.Checked = mapper.configuration.portraitMode;
            cbPortaitMode_CheckedChanged(null, null);
        }
Пример #2
0
        public static void createTrialConfiguration(Dictionary <String, LogicalOutputDevice> logicalOutputDeviceDict)
        {
            logicalOutputDeviceDict.Clear();

            LogicalOutputDevice logicalOutputDevice = new LogicalOutputDevice();

            logicalOutputDevice.logicalOutputDeviceNumber = 1;
            logicalOutputDevice.logicalDeviceName         = "Output Device 1";
            logicalOutputDevice.physicalDevicePreferenceList.Add("Out To MIDI Yoke:  2");
            logicalOutputDeviceDict.Add(logicalOutputDevice.logicalDeviceName, logicalOutputDevice);

            logicalOutputDevice = new LogicalOutputDevice();
            logicalOutputDevice.logicalOutputDeviceNumber = 2;
            logicalOutputDevice.logicalDeviceName         = "Output Device 2";
            logicalOutputDevice.physicalDevicePreferenceList.Add("Out To MIDI Yoke:  3");
            logicalOutputDeviceDict.Add(logicalOutputDevice.logicalDeviceName, logicalOutputDevice);
        }
Пример #3
0
        public void createTrialConfiguration()
        {
            dirty = true;

            try
            {
                Mapping.PerDeviceChannelMapping globalPerInputDeviceChannelMapping = new Mapping.PerDeviceChannelMapping();
                globalPerInputDeviceChannelMapping.logicalInputDeviceName = "Input Device 1";
                globalPerInputDeviceChannelMapping.inputDeviceChannel     = 0;

                ControlMapping globalControlMapping = new ControlMapping();
                globalControlMapping.soundGeneratorName            = "Reaper";
                globalControlMapping.soundGeneratorRelativeChannel = 0;
                globalControlMapping.sourceControlNumber           = 75; // Top Left Rotary Knob on Oxygen
                globalControlMapping.mappedControlNumber           = 9;  // I've got Reaper Master Volume mapped to this.
                globalControlMapping.min = 30;                           // This provides a nice workable vol range
                globalControlMapping.max = 91;
                globalPerInputDeviceChannelMapping.controlMappings.Add(globalControlMapping);

                globalControlMappings.Add(globalPerInputDeviceChannelMapping);

                primaryInputDeviceName = "Input Device 1";

                LogicalInputDevice.createTrialConfiguration(logicalInputDeviceDict);

                LogicalOutputDevice.createTrialConfiguration(logicalOutputDeviceDict);

                SoundGenerator.createTrialConfiguration(soundGenerators);

                Mapping.createTrialConfiguration(mappings);

                MidiProgram.createTrialConfiguration(midiPrograms);

                Setlist.createTrialConfiguration(songDict, setlists);
            }
            catch (Exception e)
            {
                MessageBox.Show("Exception creating trial configurations: " + e);
            }
        }
Пример #4
0
        public bool bind()
        {
            foreach (String key in logicalInputDeviceDict.Keys)
            {
                LogicalInputDevice device = logicalInputDeviceDict[key];
                if (device.bind() == false)
                {
                    return(false);
                }
            }

            // Resolve the Primary Input Device.  (If non defined, pick the first on in the dict.)
            if (primaryInputDeviceName == null && logicalInputDeviceDict.Count > 0)
            {
                primaryInputDeviceName = logicalInputDeviceDict.Keys.First <String>();
                dirty = true;
            }

            if (logicalInputDeviceDict.ContainsKey(primaryInputDeviceName))
            {
                primaryInputDevice = logicalInputDeviceDict[primaryInputDeviceName];
            }
            else
            {
                MessageBox.Show("Cannot find primary logical input device by configured name " + primaryInputDeviceName);
                return(false);
            }

            foreach (String key in logicalOutputDeviceDict.Keys)
            {
                LogicalOutputDevice device = logicalOutputDeviceDict[key];
                if (device.bind() == false)
                {
                    return(false);
                }
            }

            foreach (String key in soundGenerators.Keys)
            {
                SoundGenerator soundGenerator = soundGenerators[key];
                if (soundGenerator.bind(logicalOutputDeviceDict) == false)
                {
                    return(false);
                }
            }

            foreach (Mapping.PerDeviceChannelMapping perDeviceChannelMapping in globalControlMappings)
            {
                perDeviceChannelMapping.bind(logicalInputDeviceDict, soundGenerators);
            }

            foreach (String key in mappings.Keys)
            {
                Mapping mapping = mappings[key];
                if (mapping.bind(logicalInputDeviceDict, soundGenerators) == false)
                {
                    return(false);
                }
            }

            foreach (int bankAndProgram in midiPrograms.Keys)
            {
                MidiProgram midiProgram = midiPrograms[bankAndProgram];
                midiProgram.bind(logicalInputDeviceDict, soundGenerators, mappings, primaryInputDevice);
            }

            // Drop up any non-bound midiPrograms (ie, that point to mappings or SoundGeneratorPatches that no longer exist)
            List <MidiProgram> midiProgramListClone = midiPrograms.Values.ToList <MidiProgram>();

            foreach (MidiProgram midiProgram in midiProgramListClone)
            {
                if (midiProgram.mapping == null)
                {
                    midiPrograms.Remove(midiProgram.key);
                }
            }

            foreach (String songTitle in songDict.Keys)
            {
                Song song = songDict[songTitle];
                song.bind(logicalInputDeviceDict, soundGenerators, mappings, primaryInputDevice);
            }

            foreach (Setlist setlist in setlists)
            {
                setlist.bind(songDict, logicalInputDeviceDict, soundGenerators, mappings, primaryInputDevice);
            }


            if (primaryControllerButtonProgramNumbers.Count == 0)
            {
                int[] casioPx3Buttons = new int[8] {
                    0x0, 0x4, 0x5, 0x7, 0x12, 0x30, 0x19, 0x3D
                };
                primaryControllerButtonProgramNumbers.Add("CASIO USB-MIDI", casioPx3Buttons);
            }

            if (primaryControllerButtonProgramNumbers.ContainsKey(primaryInputDevice.device.Name))
            {
                currentPrimaryControllerButtonProgramNumbers = primaryControllerButtonProgramNumbers[primaryInputDevice.device.Name];
            }
            else
            {
                currentPrimaryControllerButtonProgramNumbers = new int[8] {
                    -1, -1, -1, -1, -1, -1, -1, -1
                };
            }

            return(true);
        }