private void ShutdownEffects() { eqNode.DisableEffectsByDefinition(eqEffect); limiterNode.DisableEffectsByDefinition(limiterEffect); reverbNode.DisableEffectsByDefinition(reverbEffect); reverbNode.EffectDefinitions.Clear(); eqNode.EffectDefinitions.Clear(); limiterNode.EffectDefinitions.Clear(); }
// // // private void CreateEchoEffect() { // create echo effect echoEffectDefinition = new EchoEffectDefinition(audGraph); // // See the MSDN page for parameter explanations // http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.xapofx.fxecho_parameters(v=vs.85).aspx echoEffectDefinition.WetDryMix = 0.7f; echoEffectDefinition.Feedback = 0.5f; echoEffectDefinition.Delay = 500.0f; // audioDeviceOutputSubmixNode.EffectDefinitions.Add(echoEffectDefinition); audioDeviceOutputSubmixNode.DisableEffectsByDefinition(echoEffectDefinition); }
private void EchoEffectToggle_Toggled(object sender, RoutedEventArgs e) { // Enable/Disable the echo effect // Also set the label for the UI if (echoEffectToggle.IsOn) { submixNode.EnableEffectsByDefinition(echoEffect); } else { submixNode.DisableEffectsByDefinition(echoEffect); } }
private async Task CreateAudioGraph() { // Create an AudioGraph with default setting AudioGraphSettings settings = new AudioGraphSettings(AudioRenderCategory.Media); CreateAudioGraphResult result = await AudioGraph.CreateAsync(settings); if (result.Status != AudioGraphCreationStatus.Success) { // Can't create the graph rootPage.NotifyUser(String.Format("AudioGraph Creation Error because {0}", result.Status.ToString()), NotifyType.ErrorMessage); return; } graph = result.Graph; // Create a device output node CreateAudioDeviceOutputNodeResult deviceOutputNodeResult = await graph.CreateDeviceOutputNodeAsync(); if (deviceOutputNodeResult.Status != AudioDeviceNodeCreationStatus.Success) { // Cannot create device output node rootPage.NotifyUser(String.Format("Audio Device Output unavailable because {0}", deviceOutputNodeResult.Status.ToString()), NotifyType.ErrorMessage); speakerContainer.Background = new SolidColorBrush(Colors.Red); return; } deviceOutputNode = deviceOutputNodeResult.DeviceOutputNode; rootPage.NotifyUser("Device Output Node successfully created", NotifyType.StatusMessage); speakerContainer.Background = new SolidColorBrush(Colors.Green); submixNode = graph.CreateSubmixNode(); submixNodeContainer.Background = new SolidColorBrush(Colors.Green); submixNode.AddOutgoingConnection(deviceOutputNode); echoEffect = new EchoEffectDefinition(graph); echoEffect.WetDryMix = 0.7f; echoEffect.Feedback = 0.5f; echoEffect.Delay = 500.0f; submixNode.EffectDefinitions.Add(echoEffect); // Disable the effect in the beginning. Enable in response to user action (UI toggle switch) submixNode.DisableEffectsByDefinition(echoEffect); // All nodes can have an OutgoingGain property // Setting the gain on the Submix node attenuates the output of the node submixNode.OutgoingGain = 0.5; // Graph successfully created. Enable buttons to load files fileButton1.IsEnabled = true; fileButton2.IsEnabled = true; }
private async Task CreateAudioGraph() { // Create an AudioGraph with default setting AudioGraphSettings settings = new AudioGraphSettings(AudioRenderCategory.Media); CreateAudioGraphResult result = await AudioGraph.CreateAsync(settings); if (result.Status != AudioGraphCreationStatus.Success) { // Can't create the graph rootPage.NotifyUser(String.Format("AudioGraph Creation Error because {0}", result.Status.ToString()), NotifyType.ErrorMessage); return; } graph = result.Graph; // Create a device output node CreateAudioDeviceOutputNodeResult deviceOutputNodeResult = await graph.CreateDeviceOutputNodeAsync(); if (deviceOutputNodeResult.Status != AudioDeviceNodeCreationStatus.Success) { // Cannot create device output node rootPage.NotifyUser(String.Format("Audio Device Output unavailable because {0}", deviceOutputNodeResult.Status.ToString()), NotifyType.ErrorMessage); speakerContainer.Background = new SolidColorBrush(Colors.Red); return; } deviceOutputNode = deviceOutputNodeResult.DeviceOutputNode; rootPage.NotifyUser("Device Output Node successfully created", NotifyType.StatusMessage); speakerContainer.Background = new SolidColorBrush(Colors.Green); submixNode = graph.CreateSubmixNode(); subMixNode.Background = new SolidColorBrush(Colors.Green); submixNode.AddOutgoingConnection(deviceOutputNode); echoEffect = new EchoEffectDefinition(graph); echoEffect.WetDryMix = 0.7f; echoEffect.Feedback = 0.5f; echoEffect.Delay = 500.0f; submixNode.EffectDefinitions.Add(echoEffect); // Disable the effect in the beginning. Enable in response to user action (UI toggle switch) submixNode.DisableEffectsByDefinition(echoEffect); // All nodes can have an OutgoingGain property // Setting the gain on the Submix node attenuates the output of the node submixNode.OutgoingGain = 0.5; // Graph successfully created. Enable buttons to load files fileButton1.IsEnabled = true; fileButton2.IsEnabled = true; }