Пример #1
0
        public void AddExposedParameter(AudioParameterPath path)
        {
            if (!ContainsExposedParameter(path.parameter))
            {
                List <ExposedAudioParameter> parameters = new List <ExposedAudioParameter>(exposedParameters);
                ExposedAudioParameter        newParam   = new ExposedAudioParameter();
                newParam.name = FindUniqueParameterName("MyExposedParam", exposedParameters);
                newParam.guid = path.parameter;
                parameters.Add(newParam);

                // We sort the exposed params by path
                parameters.Sort(SortFuncForExposedParameters);

                exposedParameters = parameters.ToArray();
                OnChangedExposedParameter();

                //Cache the path!
                exposedParamCache[path.parameter] = path;

                AudioMixerUtility.RepaintAudioMixerAndInspectors();
            }
            else
            {
                Debug.LogError("Cannot expose the same parameter more than once!");
            }
        }
Пример #2
0
        public void AddExposedParameter(AudioParameterPath path)
        {
            if (path == null)
            {
                Debug.LogError("Trying to expose null parameter.");
                return;
            }

            if (path.parameter == default)
            {
                Debug.LogError("Trying to expose parameter with default GUID.");
                return;
            }

            if (ContainsExposedParameter(path.parameter))
            {
                Debug.LogError("Cannot expose the same parameter more than once.");
                return;
            }

            var parameters = new List <ExposedAudioParameter>(exposedParameters);
            var newParam   = new ExposedAudioParameter();

            newParam.name = FindUniqueParameterName("MyExposedParam", exposedParameters);
            newParam.guid = path.parameter;
            parameters.Add(newParam);

            // We sort the exposed params by path
            parameters.Sort(SortFuncForExposedParameters);

            exposedParameters = parameters.ToArray();
            OnChangedExposedParameter();

            //Cache the path!
            exposedParamCache[path.parameter] = path;

            AudioMixerUtility.RepaintAudioMixerAndInspectors();
        }
Пример #3
0
 int SortFuncForExposedParameters(ExposedAudioParameter p1, ExposedAudioParameter p2)
 {
     return(string.CompareOrdinal(ResolveExposedParameterPath(p1.guid, true), ResolveExposedParameterPath(p2.guid, true)));
 }
 private int SortFuncForExposedParameters(ExposedAudioParameter p1, ExposedAudioParameter p2)
 {
   return string.CompareOrdinal(this.ResolveExposedParameterPath(p1.guid, true), this.ResolveExposedParameterPath(p2.guid, true));
 }
 private string FindUniqueParameterName(string template, ExposedAudioParameter[] parameters)
 {
   string str = template;
   int num = 1;
   for (int index = 0; index < parameters.Length; ++index)
   {
     if (str == parameters[index].name)
     {
       str = template + " " + (object) num++;
       index = -1;
     }
   }
   return str;
 }
		private string FindUniqueParameterName(string template, ExposedAudioParameter[] parameters)
		{
			string text = template;
			int num = 1;
			for (int i = 0; i < parameters.Length; i++)
			{
				if (text == parameters[i].name)
				{
					text = template + " " + num++;
					i = -1;
				}
			}
			return text;
		}