Пример #1
0
        // </SnippetAddBackgroundAudioTrack>

        private void AddCustomAudioEffect()
        {
            // <SnippetAddCustomAudioEffect>
            // Create a property set and add a property/value pair
            PropertySet echoProperties = new PropertySet();

            echoProperties.Add("Mix", 0.5f);

            // Instantiate the custom effect defined in the 'AudioEffectComponent' project
            AudioEffectDefinition echoEffectDefinition = new AudioEffectDefinition(typeof(ExampleAudioEffect).FullName, echoProperties);

            // Add custom audio effect to the current clip in the timeline
            var currentClip = composition.Clips.FirstOrDefault(
                mc => mc.StartTimeInComposition <= mediaPlayerElement.MediaPlayer.PlaybackSession.Position &&
                mc.EndTimeInComposition >= mediaPlayerElement.MediaPlayer.PlaybackSession.Position);

            currentClip.AudioEffectDefinitions.Add(echoEffectDefinition);

            // Add custom audio effect to the first background audio track
            if (composition.BackgroundAudioTracks.Count > 0)
            {
                composition.BackgroundAudioTracks[0].AudioEffectDefinitions.Add(echoEffectDefinition);
            }
            // </SnippetAddCustomAudioEffect>
        }
        private void AddCustomEffect()
        {
            // Create a property set and add a property/value pair
            PropertySet echoProperties = new PropertySet();

            echoProperties.Add("Mix", 0.5f);

            // Instantiate the custom effect defined in the 'CustomEffect' project
            AudioEffectDefinition echoEffectDefinition = new AudioEffectDefinition(typeof(AudioEchoEffect).FullName, echoProperties);

            fileInputNode.EffectDefinitions.Add(echoEffectDefinition);
        }
Пример #3
0
        private void AddCustomEffect()
        {
            PropertySet wahwahProperties = new PropertySet
            {
                { "Max frequency", 2000f },
                { "Q", 0.5f }
            };

            AudioEffectDefinition wahwahDefinition = new AudioEffectDefinition(typeof(NWavesEffect).FullName, wahwahProperties);

            fileInputNode.EffectDefinitions.Add(wahwahDefinition);
        }
Пример #4
0
        private void AddCustomEffect()
        {
            // Create a property set and add a property/value pair
            echoProperties = new PropertySet();
            echoProperties.Add("Mix", 0.5f);
            echoProperties.Add("Data", new double[512]);

            // Instantiate the custom effect defined in the 'CustomEffect' project
            AudioEffectDefinition echoEffectDefinition = new AudioEffectDefinition(typeof(AudioEchoEffect).FullName, echoProperties);

            fileInputNode.EffectDefinitions.Add(echoEffectDefinition);

            audioTimer = new Timer(Callback, null, 50, 0);
        }
        private void DrawPitchSection(AudioEffectDefinition audioEffectDefinition)
        {
            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("Pitch settings", EditorStyles.boldLabel);
            audioEffectDefinition.UsesRandomPitch = EditorGUILayout.ToggleLeft("Use random pitch", audioEffectDefinition.UsesRandomPitch);

            if (audioEffectDefinition.UsesRandomPitch)
            {
                EditorGUILayout.LabelField("Minimal possible pitch:", audioEffectDefinition.PitchVarietyMin.ToString());
                EditorGUILayout.LabelField("Maximum possible pitch:", audioEffectDefinition.PitchVarietyMax.ToString());
                EditorGUILayout.MinMaxSlider(ref audioEffectDefinition.PitchVarietyMin,
                                             ref audioEffectDefinition.PitchVarietyMax, minAudioPitchLimit, maxAudioPitchLimit);
            }
        }
Пример #6
0
 public static void GetEQCurrent(EQInitialize eqinit)
 {
     var audio = AudioEffectsManager.CreateAudioRenderEffectsManager(MediaDevice.GetDefaultAudioRenderId(AudioDeviceRole.Default), Windows.Media.Render.AudioRenderCategory.Media);
     var asd= new AudioEffectDefinition("sadawd");
     var supportedEncodingProperties = new List<AudioEncodingProperties>();
     AudioEncodingProperties encodingProps1 = AudioEncodingProperties.CreatePcm(44100, 1, 32);
     encodingProps1.Subtype = MediaEncodingSubtypes.Float;
     AudioEncodingProperties encodingProps2 = AudioEncodingProperties.CreatePcm(48000, 1, 32);
     encodingProps2.Subtype = MediaEncodingSubtypes.Float;
     supportedEncodingProperties.Add(encodingProps1);
     supportedEncodingProperties.Add(encodingProps2);
     switch (eqinit)
     {
         case EQInitialize.无:
             break;
         case EQInitialize.重低音强化:
             break;
         case EQInitialize.低音强化:
             break;
         case EQInitialize.高音强化:
             break;
         case EQInitialize.古典音乐:
             break;
         case EQInitialize.响度:
             break;
         case EQInitialize.嘻哈:
             break;
         case EQInitialize.声音强化:
             break;
         case EQInitialize.摇滚:
             break;
         case EQInitialize.流行音乐:
             break;
         case EQInitialize.爵士:
             break;
         case EQInitialize.电子:
             break;
         case EQInitialize.舞曲:
             break;
         case EQInitialize.节奏布鲁斯:
             break;
         case EQInitialize.语音:
             break;
         case EQInitialize.音响效果:
             break;
         default:
             break;
     }
 }
 private void DrawLifecycleSettings(AudioEffectDefinition audioEffectDefinition)
 {
     EditorGUILayout.Separator();
     EditorGUILayout.LabelField("Lifecycle settings", EditorStyles.boldLabel);
     audioEffectDefinition.Loops = EditorGUILayout.ToggleLeft("Loops", audioEffectDefinition.Loops);
     if (!audioEffectDefinition.Loops)
     {
         audioEffectDefinition.AutokillOnEnd =
             EditorGUILayout.ToggleLeft("Destroys on end", audioEffectDefinition.AutokillOnEnd);
     }
     else
     {
         audioEffectDefinition.AutokillOnEnd = false;
     }
 }
        private void DrawAudioSection(AudioEffectDefinition audioEffectDefiniton)
        {
            EditorGUILayout.LabelField("Clip settings", EditorStyles.boldLabel);
            audioEffectDefiniton.UseRandom = EditorGUILayout.ToggleLeft("Use random", audioEffectDefiniton.UseRandom);
            EditorGUI.BeginChangeCheck();
            if (audioEffectDefiniton.UseRandom)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("RandomClips"), true);
            }
            else
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("AudioClip"), true);
            }

            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }
        }
Пример #9
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);
        }
Пример #10
0
        /// <summary>
        /// Create an instance of the pre-supplied reverb effect and add it to the output node
        /// </summary>
        private void AddCustomEcho()
        {
            // Built in echo effect
            //EchoEffectDefinition echoEffect = new EchoEffectDefinition(_graph)
            //{
            //    Delay = 2000
            //};

            //_submixNode.EffectDefinitions.Add(echoEffect);

            // Custom effect
            // Create a property set and add a property/value pair
            PropertySet echoProperties = new PropertySet();

            echoProperties.Add("Mix", 0.7f);
            echoProperties.Add("Delay", 500.0f);
            echoProperties.Add("Feedback", 0.5f);

            // Instantiate the custom effect defined in the 'AudioEffectComponent' project
            AudioEffectDefinition echoEffectDefinition = new AudioEffectDefinition(typeof(ExampleAudioEffect).FullName, echoProperties);

            _submixNode.EffectDefinitions.Add(echoEffectDefinition);
        }
        public void DrawVolumeSettings(AudioEffectDefinition audioEffectDefinition)
        {
            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("Volume settings", EditorStyles.boldLabel);
            EditorGUILayout.LabelField("Volume");
            audioEffectDefinition.Volume = EditorGUILayout.Slider(audioEffectDefinition.Volume, 0f, 1f);

            audioEffectDefinition.FadesIn = EditorGUILayout.ToggleLeft("Fades in", audioEffectDefinition.FadesIn);
            if (audioEffectDefinition.FadesIn)
            {
                EditorGUILayout.LabelField("Gains max volume at percentage:");
                audioEffectDefinition.FadeInEndPercentage = EditorGUILayout.Slider(audioEffectDefinition.FadeInEndPercentage, 0f, 1f);
            }

            audioEffectDefinition.FadesOut = EditorGUILayout.ToggleLeft("Fades out", audioEffectDefinition.FadesOut);
            if (audioEffectDefinition.FadesOut)
            {
                EditorGUILayout.LabelField("Starts to lose volume at percentage:");
                var sliderStartValue = audioEffectDefinition.FadesIn ? audioEffectDefinition.FadeInEndPercentage : 0f;

                audioEffectDefinition.FadeOutBeginPercentage = EditorGUILayout.Slider(audioEffectDefinition.FadeOutBeginPercentage, sliderStartValue, 1f);
            }
            audioEffectDefinition.Is3DSound = EditorGUILayout.ToggleLeft("Is 3D sound", audioEffectDefinition.Is3DSound);
        }
        private void AddCustomEffect()
        {
            // Create a property set and add a property/value pair
            PropertySet echoProperties = new PropertySet();
            echoProperties.Add("Mix", 0.5f);

            // Instantiate the custom effect defined in the 'CustomEffect' project
            AudioEffectDefinition echoEffectDefinition = new AudioEffectDefinition(typeof(AudioEchoEffect).FullName, echoProperties);
            fileInputNode.EffectDefinitions.Add(echoEffectDefinition);
        }
Пример #13
0
            public static void GetEQCurrent(EQInitialize eqinit)
            {
                var audio = AudioEffectsManager.CreateAudioRenderEffectsManager(MediaDevice.GetDefaultAudioRenderId(AudioDeviceRole.Default), Windows.Media.Render.AudioRenderCategory.Media);
                var asd   = new AudioEffectDefinition("sadawd");
                var supportedEncodingProperties        = new List <AudioEncodingProperties>();
                AudioEncodingProperties encodingProps1 = AudioEncodingProperties.CreatePcm(44100, 1, 32);

                encodingProps1.Subtype = MediaEncodingSubtypes.Float;
                AudioEncodingProperties encodingProps2 = AudioEncodingProperties.CreatePcm(48000, 1, 32);

                encodingProps2.Subtype = MediaEncodingSubtypes.Float;
                supportedEncodingProperties.Add(encodingProps1);
                supportedEncodingProperties.Add(encodingProps2);
                switch (eqinit)
                {
                case EQInitialize.无:
                    break;

                case EQInitialize.重低音强化:
                    break;

                case EQInitialize.低音强化:
                    break;

                case EQInitialize.高音强化:
                    break;

                case EQInitialize.古典音乐:
                    break;

                case EQInitialize.响度:
                    break;

                case EQInitialize.嘻哈:
                    break;

                case EQInitialize.声音强化:
                    break;

                case EQInitialize.摇滚:
                    break;

                case EQInitialize.流行音乐:
                    break;

                case EQInitialize.爵士:
                    break;

                case EQInitialize.电子:
                    break;

                case EQInitialize.舞曲:
                    break;

                case EQInitialize.节奏布鲁斯:
                    break;

                case EQInitialize.语音:
                    break;

                case EQInitialize.音响效果:
                    break;

                default:
                    break;
                }
            }
Пример #14
0
        private void AddCustomEffect()
        {
            // Create a property set and add a property/value pair
            echoProperties = new PropertySet();
            echoProperties.Add("Mix", 0.5f);
            echoProperties.Add("Data", new double[512]);

            // Instantiate the custom effect defined in the 'CustomEffect' project
            AudioEffectDefinition echoEffectDefinition = new AudioEffectDefinition(typeof(AudioEchoEffect).FullName, echoProperties);
            fileInputNode.EffectDefinitions.Add(echoEffectDefinition);

            audioTimer = new Timer(Callback, null, 50, 0);
        }