public static EventInstance Clone(this EventInstance eventInstance) { string path = Audio.GetEventName(eventInstance); if (string.IsNullOrEmpty(path)) { return(null); } EventInstance cloneInstance = Audio.CreateInstance(path); if (cloneInstance == null) { return(null); } if (eventInstance.IsNeedManualClone()) { cloneInstance.NeedManualClone(); } ConcurrentDictionary <string, float> parameters = eventInstance.GetSavedParameterValues(); if (parameters != null) { foreach (KeyValuePair <string, float> pair in parameters) { cloneInstance.setParameterValue(pair.Key, pair.Value); } } cloneInstance.CopyTimelinePosition(eventInstance); return(cloneInstance); }
public static EventInstance Clone(this EventInstance eventInstance) { string path = eventInstance.GetExtendedString(PathKey); if (string.IsNullOrEmpty(path)) { return(null); } EventInstance cloneInstance = Audio.CreateInstance(path); if (cloneInstance == null) { return(null); } cloneInstance.SavePath(path); var parameters = eventInstance.GetExtendedDataValue <Dictionary <string, float> >(ParametersKey); if (parameters != null) { foreach (var pair in parameters) { cloneInstance.setParameterValue(pair.Key, pair.Value); cloneInstance.SaveParameters(pair.Key, pair.Value); } } cloneInstance.CopyTimelinePosition(eventInstance); return(cloneInstance); }