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(); } }
// extra data 1: file path // extra data 2: device name // extra data 3: second device name public override void HotkeyTriggered() { if (audioDevice == null) { audioDevice = MainAudio.Instance.GetDevice(ExtraData2); } MainLogic.Instance.InputCallbacks.TextResultRequestOnTopCallback("Text", (bool speakCanceled, string speakInput) => { if (!speakCanceled) { try { string fileName = "tts_" + Guid.NewGuid() + ".wav"; if (speechSynthesizer == null) { speechSynthesizer = new SpeechSynthesizer(); } speechSynthesizer.SetOutputToWaveFile(fileName); speechSynthesizer.Speak(speakInput); try { speechSynthesizer?.Dispose(); } catch (Exception) { } speechSynthesizer = null; //var voices = speechSynthesizer.GetInstalledVoices(); files.Add(fileName); CachedSound sound = new CachedSound(fileName); provider = audioDevice.AssociatedEngine.PlaySound(sound); if (!String.IsNullOrWhiteSpace(ExtraData3)) { if (audioDeviceTwo == null) { audioDeviceTwo = MainAudio.Instance.GetDevice(ExtraData3); } providerTwo = audioDeviceTwo.AssociatedEngine.PlaySound(sound); } if (AdditionalExtraData != null && AdditionalExtraData.ContainsKey((int)HotkeyAdditionalDataType.DeviceThree) && !String.IsNullOrWhiteSpace(AdditionalExtraData[(int)HotkeyAdditionalDataType.DeviceThree])) { if (audioDeviceThree == null) { audioDeviceThree = MainAudio.Instance.GetDevice(AdditionalExtraData[(int)HotkeyAdditionalDataType.DeviceThree]); } providerThree = audioDeviceThree.AssociatedEngine.PlaySound(sound); } } catch (Exception ex) { } } }); }
public override void Load() { if (audioDevice == null) { audioDevice = MainAudio.Instance.GetDevice(ExtraData2, AudioDeviceType.Input); } }
// extra data 1: file path // extra data 2: device name // extra data 3: second device name public override void HotkeyTriggered() { if (audioDevice == null) { audioDevice = MainAudio.Instance.GetDevice(ExtraData2); } provider = audioDevice.AssociatedEngine.PlaySound(cachedSound); if (!String.IsNullOrWhiteSpace(ExtraData3)) { if (audioDeviceTwo == null) { audioDeviceTwo = MainAudio.Instance.GetDevice(ExtraData3); } providerTwo = audioDeviceTwo.AssociatedEngine.PlaySound(cachedSound); } if (AdditionalExtraData != null && AdditionalExtraData.ContainsKey((int)HotkeyAdditionalDataType.DeviceThree) && !String.IsNullOrWhiteSpace(AdditionalExtraData[(int)HotkeyAdditionalDataType.DeviceThree])) { if (audioDeviceThree == null) { audioDeviceThree = MainAudio.Instance.GetDevice(AdditionalExtraData[(int)HotkeyAdditionalDataType.DeviceThree]); } providerThree = audioDeviceThree.AssociatedEngine.PlaySound(cachedSound); } }
// extra data 2: device name public override void HotkeyTriggered() { if (audioDevice == null) { audioDevice = MainAudio.Instance.GetDevice(ExtraData2); } audioDevice.AssociatedEngine.StopAllSounds(); }
public override void Load() { if (audioInputDevice == null && !String.IsNullOrWhiteSpace(ExtraData1)) { audioInputDevice = MainAudio.Instance.GetDevice(ExtraData1, AudioDeviceType.Input); } if (audioOutputDevice == null && !String.IsNullOrWhiteSpace(ExtraData2)) { audioOutputDevice = MainAudio.Instance.GetDevice(ExtraData2, AudioDeviceType.Output); } if (audioOutputDeviceTwo == null && !String.IsNullOrWhiteSpace(ExtraData3)) { audioOutputDeviceTwo = MainAudio.Instance.GetDevice(ExtraData3, AudioDeviceType.Output); } }
public override void Load() { if (audioDevice == null) { audioDevice = MainAudio.Instance.GetDevice(ExtraData2); } if (audioDevice2 == null && !String.IsNullOrWhiteSpace(ExtraData3)) { audioDevice2 = MainAudio.Instance.GetDevice(ExtraData3); } if (volumeSetTo == -1.0f) { float volumeConverted = -1.0f; if (!float.TryParse(ExtraData1, out volumeConverted)) { Console.WriteLine("Error: volume amount is not a float."); } volumeSetTo = volumeConverted; } }
public override void Load() { if (audioDevice == null) { audioDevice = MainAudio.Instance.GetDevice(ExtraData2, AudioDeviceType.Input); if (audioDevice.Recorders.Count > 0) { recorder = audioDevice.Recorders[0]; } else { if (audioDevice != null) { int finalSecondsToWait = 0; if (!int.TryParse(ExtraData3, out finalSecondsToWait)) { finalSecondsToWait = 30; } AudioRecorder newRecorder = new AudioRecorder(audioDevice, finalSecondsToWait); recorder = newRecorder; } } } }