GetEffectParameters() public static méthode

public static GetEffectParameters ( string effect ) : UnityEditor.Audio.MixerParameterDefinition[]
effect string
Résultat UnityEditor.Audio.MixerParameterDefinition[]
Exemple #1
0
 public void CopyEffectSettingsToAllSnapshots(AudioMixerGroupController group, int effectIndex, AudioMixerSnapshotController snapshot, bool includeWetParam)
 {
     AudioMixerSnapshotController[] snaps = snapshots;
     for (int n = 0; n < snaps.Length; n++)
     {
         if (snaps[n] == snapshot)
         {
             continue;
         }
         var effect = group.effects[effectIndex];
         MixerParameterDefinition[] paramDefs = MixerEffectDefinitions.GetEffectParameters(effect.effectName);
         float value;
         if (includeWetParam)
         {
             var guid = effect.GetGUIDForMixLevel();
             if (snapshot.GetValue(guid, out value))
             {
                 snaps[n].SetValue(guid, value);
             }
         }
         foreach (var p in paramDefs)
         {
             var guid = effect.GetGUIDForParameter(p.name);
             if (snapshot.GetValue(guid, out value))
             {
                 snaps[n].SetValue(guid, value);
             }
         }
     }
 }
Exemple #2
0
        public override string ResolveStringPath(bool getOnlyBasePath)
        {
            if (getOnlyBasePath)
            {
                return(GetBasePath(group.GetDisplayString(), effect.effectName));
            }

            if (effect.GetGUIDForMixLevel() == parameter)
            {
                return("Mix Level" + GetBasePath(group.GetDisplayString(), effect.effectName));
            }
            else
            {
                MixerParameterDefinition[] paramDefs = MixerEffectDefinitions.GetEffectParameters(effect.effectName);
                for (int i = 0; i < paramDefs.Length; i++)
                {
                    GUID guid = effect.GetGUIDForParameter(paramDefs[i].name);
                    if (guid == parameter)
                    {
                        return(paramDefs[i].name + GetBasePath(group.GetDisplayString(), effect.effectName));
                    }
                }

                return("Error finding Parameter path.");
            }
        }
Exemple #3
0
        public AudioMixerEffectController CopyEffect(AudioMixerEffectController sourceEffect)
        {
            var copiedEffect = new AudioMixerEffectController(sourceEffect.effectName);

            copiedEffect.name = sourceEffect.name;
            copiedEffect.PreallocateGUIDs();
            MixerParameterDefinition[] paramDefs = MixerEffectDefinitions.GetEffectParameters(sourceEffect.effectName);
            float value;

            foreach (var s in snapshots)
            {
                if (s.GetValue(sourceEffect.GetGUIDForMixLevel(), out value))
                {
                    s.SetValue(copiedEffect.GetGUIDForMixLevel(), value);
                }
                foreach (var p in paramDefs)
                {
                    if (s.GetValue(sourceEffect.GetGUIDForParameter(p.name), out value))
                    {
                        s.SetValue(copiedEffect.GetGUIDForParameter(p.name), value);
                    }
                }
            }

            AssetDatabase.AddObjectToAsset(copiedEffect, this);
            return(copiedEffect);
        }
Exemple #4
0
        public override string ResolveStringPath(bool getOnlyBasePath)
        {
            string result;

            if (getOnlyBasePath)
            {
                result = base.GetBasePath(this.group.GetDisplayString(), this.effect.effectName);
            }
            else if (this.effect.GetGUIDForMixLevel() == this.parameter)
            {
                result = "Mix Level" + base.GetBasePath(this.group.GetDisplayString(), this.effect.effectName);
            }
            else
            {
                MixerParameterDefinition[] effectParameters = MixerEffectDefinitions.GetEffectParameters(this.effect.effectName);
                for (int i = 0; i < effectParameters.Length; i++)
                {
                    GUID gUIDForParameter = this.effect.GetGUIDForParameter(effectParameters[i].name);
                    if (gUIDForParameter == this.parameter)
                    {
                        result = effectParameters[i].name + base.GetBasePath(this.group.GetDisplayString(), this.effect.effectName);
                        return(result);
                    }
                }
                result = "Error finding Parameter path.";
            }
            return(result);
        }
Exemple #5
0
        public override string ResolveStringPath(bool getOnlyBasePath)
        {
            if (getOnlyBasePath)
            {
                return(GetBasePath(group.GetDisplayString(), effect.effectName));
            }

            if (effect.GetGUIDForMixLevel() == parameter)
            {
                if (effect.IsSend())
                {
                    var allGroups = group.controller.GetAllAudioGroupsSlow();
                    var effectMap = AudioMixerGroupController.GetEffectMapSlow(allGroups);
                    return($"Send level{GetBasePath(group.GetDisplayString(), null)} to {effect.sendTarget.GetDisplayString(effectMap)}");
                }

                return($"Mix Level{GetBasePath(group.GetDisplayString(), effect.effectName)}");
            }

            MixerParameterDefinition[] paramDefs = MixerEffectDefinitions.GetEffectParameters(effect.effectName);

            for (int i = 0; i < paramDefs.Length; i++)
            {
                GUID guid = effect.GetGUIDForParameter(paramDefs[i].name);

                if (guid == parameter)
                {
                    return(paramDefs[i].name + GetBasePath(group.GetDisplayString(), effect.effectName));
                }
            }

            return("Error finding Parameter path.");
        }
Exemple #6
0
        public string ResolveExposedParameterPath(GUID parameter, bool getOnlyBasePath)
        {
            // Consult the cache of parameters first.
            if (exposedParamCache.ContainsKey(parameter))
            {
                var path = exposedParamCache[parameter];

                return(path.ResolveStringPath(getOnlyBasePath));
            }

            // Search through the whole mixer!
            List <AudioMixerGroupController> groups = GetAllAudioGroupsSlow();

            foreach (AudioMixerGroupController group in groups)
            {
                if (group.GetGUIDForVolume() == parameter || group.GetGUIDForPitch() == parameter)
                {
                    var newPath = new AudioGroupParameterPath(group, parameter);
                    exposedParamCache[parameter] = newPath;
                    return(newPath.ResolveStringPath(getOnlyBasePath));
                }

                for (var i = 0; i < group.effects.Length; i++)
                {
                    var effect = group.effects[i];

                    if (effect.IsSend() && parameter == effect.GetGUIDForMixLevel())
                    {
                        var newPath = new AudioEffectParameterPath(group, effect, parameter);
                        exposedParamCache[parameter] = newPath;
                        return(newPath.ResolveStringPath(getOnlyBasePath));
                    }

                    var paramDefs = MixerEffectDefinitions.GetEffectParameters(effect.effectName);

                    for (var j = 0; j < paramDefs.Length; j++)
                    {
                        var guid = effect.GetGUIDForParameter(paramDefs[j].name);

                        if (guid == parameter)
                        {
                            var newPath = new AudioEffectParameterPath(group, effect, parameter);
                            exposedParamCache[parameter] = newPath;
                            return(newPath.ResolveStringPath(getOnlyBasePath));
                        }
                    }
                }
            }

            return("Error finding Parameter path");
        }
Exemple #7
0
 public override string ResolveStringPath(bool getOnlyBasePath)
 {
     if (getOnlyBasePath)
     {
         return(base.GetBasePath(base.group.GetDisplayString(), this.effect.effectName));
     }
     if (this.effect.GetGUIDForMixLevel() == base.parameter)
     {
         return("Mix Level" + base.GetBasePath(base.group.GetDisplayString(), this.effect.effectName));
     }
     MixerParameterDefinition[] effectParameters = MixerEffectDefinitions.GetEffectParameters(this.effect.effectName);
     for (int i = 0; i < effectParameters.Length; i++)
     {
         if (this.effect.GetGUIDForParameter(effectParameters[i].name) == base.parameter)
         {
             return(effectParameters[i].name + base.GetBasePath(base.group.GetDisplayString(), this.effect.effectName));
         }
     }
     return("Error finding Parameter path.");
 }