Exemplo n.º 1
0
 private Dictionary <int, string> GetChannelToPresetDictionary(
     LevelDriverSource levelDriverSource
     )
 {
     if (levelDriverSource == LevelDriverSource.Audio)
     {
         return(this.config.channelToAudioLevelDriverPreset);
     }
     else if (levelDriverSource == LevelDriverSource.Midi)
     {
         return(this.config.channelToMidiLevelDriverPreset);
     }
     else
     {
         throw new Exception("unknown LevelDriverSource!");
     }
 }
Exemplo n.º 2
0
 private void SetChannelToPresetDictionary(
     LevelDriverSource levelDriverSource,
     Dictionary <int, string> channelToPresetDictionary
     )
 {
     if (levelDriverSource == LevelDriverSource.Audio)
     {
         this.config.channelToAudioLevelDriverPreset = channelToPresetDictionary;
     }
     else if (levelDriverSource == LevelDriverSource.Midi)
     {
         this.config.channelToMidiLevelDriverPreset = channelToPresetDictionary;
     }
     else
     {
         throw new Exception("unknown LevelDriverSource!");
     }
 }
Exemplo n.º 3
0
        private void ResetItemsOfChannelComboBox(
            ComboBox box,
            int i, // box index, 0-7
            LevelDriverSource levelDriverSource
            )
        {
            string currentName = null;

            if (
                levelDriverSource == LevelDriverSource.Audio &&
                this.config.channelToAudioLevelDriverPreset.ContainsKey(i)
                )
            {
                currentName = this.config.channelToAudioLevelDriverPreset[i];
            }
            else if (
                levelDriverSource == LevelDriverSource.Midi &&
                this.config.channelToMidiLevelDriverPreset.ContainsKey(i)
                )
            {
                currentName = this.config.channelToMidiLevelDriverPreset[i];
            }

            box.Items.Clear();
            int boxItemIndex = 0;
            int currentIndex = -1;

            foreach (var levelDriverPair in this.config.levelDriverPresets)
            {
                ILevelDriverPreset config = levelDriverPair.Value;
                if (config.Source != levelDriverSource)
                {
                    continue;
                }
                box.Items.Add(config.Name);
                if (currentName != null && currentName == config.Name)
                {
                    currentIndex = boxItemIndex;
                }
                boxItemIndex++;
            }
            box.SelectedIndex = currentIndex;
        }