Ejemplo n.º 1
0
        private void LoadAudioPassthroughSettings()
        {
            HotkeyAudioDevice inputDevice = MainAudio.Instance.GetDevice(ExtraData1, AudioDeviceType.Input);

            HotkeyAudioDevice outputDevice = MainAudio.Instance.GetDevice(ExtraData2, AudioDeviceType.Output);


            foreach (AudioPassthroughSettings audioPassthroughSetting in inputDevice.Passthroughs)
            {
                if (audioPassthroughSetting.InputDevice.AudioDeviceId == inputDevice.AudioDeviceId && audioPassthroughSetting.OutputDevice.AudioDeviceId == outputDevice.AudioDeviceId)
                {
                    AudioPassthroughSettings = audioPassthroughSetting;
                    break;
                }
            }
            if (AudioPassthroughSettings == null)
            {
                foreach (AudioPassthroughSettings audioPassthroughSetting in outputDevice.Passthroughs)
                {
                    if (audioPassthroughSetting.InputDevice.AudioDeviceId == inputDevice.AudioDeviceId && audioPassthroughSetting.OutputDevice.AudioDeviceId == outputDevice.AudioDeviceId)
                    {
                        AudioPassthroughSettings = audioPassthroughSetting;
                        break;
                    }
                }
            }

            if (AudioPassthroughSettings != null)
            {
                LoadAutoTuneSettings();
            }
        }
Ejemplo n.º 2
0
        public override void Load()
        {
            AudioPassthroughSettings = new AudioPassthroughSettings();
            if (AudioPassthroughSettings.InputDevice == null)
            {
                AudioPassthroughSettings.InputDevice = MainAudio.Instance.GetDevice(ExtraData1, AudioDeviceType.Input);
            }

            if (AudioPassthroughSettings.OutputDevice == null)
            {
                AudioPassthroughSettings.OutputDevice = MainAudio.Instance.GetDevice(ExtraData2, AudioDeviceType.Output);
            }

            AudioPassthroughSettings.AutoTuneSettings = new AutoTuneSettings();

            string startOnSaved = this.GetAdditionalData(HotkeyAdditionalDataType.ExtraData4);

            if (!String.IsNullOrWhiteSpace(startOnSaved))
            {
                StartOn = bool.Parse(startOnSaved);
            }

            AudioPassthroughSettings.AssociatedHotkey = this;

            AudioPassthroughSettings.InputDevice.Passthroughs.Add(AudioPassthroughSettings);
            AudioPassthroughSettings.OutputDevice.Passthroughs.Add(AudioPassthroughSettings);


            if (AudioPassthroughSettings.InputDevice != null && AudioPassthroughSettings.OutputDevice != null)
            {
                AudioPassthrough = new AudioPassthrough(AudioPassthroughSettings.InputDevice, AudioPassthroughSettings.OutputDevice, AudioPassthroughSettings.AutoTuneSettings);
                AudioPassthroughSettings.AudioPassthrough = AudioPassthrough;

                if (StartOn)
                {
                    StartPassingThrough();
                    Enabled = true;
                }
            }
        }