Exemple #1
0
        private void CreateAndAddEchoEffect()
        {
            EchoEffectDefinition echoEffectDefinition = new EchoEffectDefinition(this._audioGraph);

            echoEffectDefinition.WetDryMix = 0.7f;
            echoEffectDefinition.Feedback  = 0.5f;
            echoEffectDefinition.Delay     = 100.0f;

            _fileInputNode.EffectDefinitions.Add(echoEffectDefinition);
        }
        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;
        }
Exemple #3
0
 //
 //
 //
 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);
 }
        //</SnippetCreateSubmixNode>

        private void AddEffect()
        {
            AudioSubmixNode submixNode = audioGraph.CreateSubmixNode();

            //<SnippetAddEffect>
            EchoEffectDefinition echoEffect = new EchoEffectDefinition(audioGraph);

            echoEffect.Delay     = 1000.0;
            echoEffect.Feedback  = .2;
            echoEffect.WetDryMix = .5;

            submixNode.EffectDefinitions.Add(echoEffect);
            //</SnippetAddEffect>

            fileInputNode.EffectDefinitions.Add(echoEffect);
        }
Exemple #5
0
        private void AddCustomEffect()
        {
            _properties["Noise"]      = 0.0f;
            _properties["Echo"]       = 0.0f;
            _noiseEffectDefinition    = new AudioEffectDefinition(typeof(AudioNoiseEffect).FullName, _properties);
            _properties["Echo Delay"] = 0.0f;
            _echoEffectDefinition     = new EchoEffectDefinition(_graph);
            _properties["Balance"]    = 0.0f;
            _balanceEffectDefinition  = new AudioEffectDefinition(typeof(AudioBalanceEffect).FullName, _properties);
            _spectrumExtractor        = new AudioEffectDefinition(typeof(AudioSpectrumExtractor).FullName, _properties);

            _echoEffectDefinition.Delay     = 100;
            _echoEffectDefinition.Feedback  = 0.5;
            _echoEffectDefinition.WetDryMix = 0;

            _subMixNode.EffectDefinitions.Add(_noiseEffectDefinition);
            _subMixNode.EffectDefinitions.Add(_balanceEffectDefinition);
            _subMixNode.EffectDefinitions.Add(_spectrumExtractor);
            _subMixNode.EffectDefinitions.Add(_echoEffectDefinition);
        }
Exemple #6
0
        private void InitializeEffects()
        {
            _echoEffect   = new EchoEffectDefinition(graph);
            _reverbEffect = new ReverbEffectDefinition(graph);

            _echoEffect.Delay    = echoDelayMinVal;
            _echoEffect.Feedback = echoFeedbackMinVal;

            _reverbEffect.DecayTime  = reverbDecayMinVal;
            _reverbEffect.Density    = reverbDensityMinVal;
            _reverbEffect.ReverbGain = reverbGainMinVal;

            _reverbEffect.WetDryMix        = reverbWetDryMixDefaultVal;
            _reverbEffect.ReverbDelay      = (byte)reverbDelayDefaultVal;
            _reverbEffect.RearDelay        = (byte)reverbRearDelayDefaultVal;
            _reverbEffect.RoomSize         = reverbRoomSizeDefaultVal;
            _reverbEffect.ReflectionsDelay = (byte)reverbReflectionsDelayDefaultVal;
            _reverbEffect.LowEQCutoff      = (byte)reverbLowEqCutoffDefaultVal;
            _reverbEffect.LowEQGain        = (byte)reverbLowEqGainDefaultVal;
            _reverbEffect.HighEQCutoff     = (byte)reverbHighEqCutoffDefaultVal;
            _reverbEffect.HighEQGain       = (byte)reverbHighEqGainDefaultVal;
        }
        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;
        }
        private void CreateEchoEffect()
        {
            // create echo effect
            echoEffectDefinition = new EchoEffectDefinition(graph);

            // 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;

            fileInputNode.EffectDefinitions.Add(echoEffectDefinition);
            fileInputNode.DisableEffectsByDefinition(echoEffectDefinition);
        }