GetGUIDForParameter() private method

private GetGUIDForParameter ( string parameterName ) : GUID
parameterName string
return UnityEditor.GUID
Beispiel #1
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.");
            }
        }
Beispiel #2
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);
        }
Beispiel #3
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.");
        }
        public string ResolveExposedParameterPath(GUID parameter, bool getOnlyBasePath)
        {
            //consult the cache of parameters first.
            if (exposedParamCache.ContainsKey(parameter))
            {
                AudioParameterPath 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 ||
                    group.GetGUIDForSend() == parameter)
                {
                    AudioGroupParameterPath newPath = new AudioGroupParameterPath(group, parameter);
                    exposedParamCache[parameter] = newPath;
                    return(newPath.ResolveStringPath(getOnlyBasePath));
                }
                else
                {
                    for (int i = 0; i < group.effects.Length; i++)
                    {
                        AudioMixerEffectController effect    = group.effects[i];
                        MixerParameterDefinition[] paramDefs = MixerEffectDefinitions.GetEffectParameters(effect.effectName);

                        for (int j = 0; j < paramDefs.Length; j++)
                        {
                            GUID guid = effect.GetGUIDForParameter(paramDefs[j].name);
                            if (guid == parameter)
                            {
                                AudioEffectParameterPath newPath = new AudioEffectParameterPath(group, effect, parameter);
                                exposedParamCache[parameter] = newPath;
                                return(newPath.ResolveStringPath(getOnlyBasePath));
                            }
                        }
                    }
                }
            }
            return("Error finding Parameter path");
        }
 public AudioMixerEffectController CopyEffect(AudioMixerEffectController sourceEffect)
 {
   AudioMixerEffectController effectController = new AudioMixerEffectController(sourceEffect.effectName);
   effectController.name = sourceEffect.name;
   effectController.PreallocateGUIDs();
   MixerParameterDefinition[] effectParameters = MixerEffectDefinitions.GetEffectParameters(sourceEffect.effectName);
   foreach (AudioMixerSnapshotController snapshot in this.snapshots)
   {
     float num;
     if (snapshot.GetValue(sourceEffect.GetGUIDForMixLevel(), out num))
       snapshot.SetValue(effectController.GetGUIDForMixLevel(), num);
     foreach (MixerParameterDefinition parameterDefinition in effectParameters)
     {
       if (snapshot.GetValue(sourceEffect.GetGUIDForParameter(parameterDefinition.name), out num))
         snapshot.SetValue(effectController.GetGUIDForParameter(parameterDefinition.name), num);
     }
   }
   AssetDatabase.AddObjectToAsset((UnityEngine.Object) effectController, (UnityEngine.Object) this);
   return effectController;
 }
		public AudioMixerEffectController CopyEffect(AudioMixerEffectController sourceEffect)
		{
			AudioMixerEffectController audioMixerEffectController = new AudioMixerEffectController(sourceEffect.effectName);
			audioMixerEffectController.name = sourceEffect.name;
			audioMixerEffectController.PreallocateGUIDs();
			MixerParameterDefinition[] effectParameters = MixerEffectDefinitions.GetEffectParameters(sourceEffect.effectName);
			AudioMixerSnapshotController[] snapshots = this.snapshots;
			for (int i = 0; i < snapshots.Length; i++)
			{
				AudioMixerSnapshotController audioMixerSnapshotController = snapshots[i];
				float value;
				if (audioMixerSnapshotController.GetValue(sourceEffect.GetGUIDForMixLevel(), out value))
				{
					audioMixerSnapshotController.SetValue(audioMixerEffectController.GetGUIDForMixLevel(), value);
				}
				MixerParameterDefinition[] array = effectParameters;
				for (int j = 0; j < array.Length; j++)
				{
					MixerParameterDefinition mixerParameterDefinition = array[j];
					if (audioMixerSnapshotController.GetValue(sourceEffect.GetGUIDForParameter(mixerParameterDefinition.name), out value))
					{
						audioMixerSnapshotController.SetValue(audioMixerEffectController.GetGUIDForParameter(mixerParameterDefinition.name), value);
					}
				}
			}
			AssetDatabase.AddObjectToAsset(audioMixerEffectController, this);
			return audioMixerEffectController;
		}