internal static AudioSourceExtension AddAmbisonicDecoderExtension(AudioSource source) { AudioSourceExtension result; if (source.ambisonicExtension != null) { result = source.ambisonicExtension; } else { AudioExtensionManager.RegisterBuiltinDefinitions(); foreach (AudioAmbisonicExtensionDefinition audioAmbisonicExtensionDefinition in AudioExtensionManager.m_SourceAmbisonicDecoderExtensionDefinitions) { if (AudioSettings.GetAmbisonicDecoderPluginName() == audioAmbisonicExtensionDefinition.ambisonicPluginName) { AudioSourceExtension audioSourceExtension = source.AddAmbisonicExtension(audioAmbisonicExtensionDefinition.definition.GetExtensionType()); if (audioSourceExtension != null) { audioSourceExtension.audioSource = source; source.ambisonicExtension = audioSourceExtension; return(audioSourceExtension); } } } result = null; } return(result); }
// Check to see if we need to add an ambisonic decoder extension to this audio source, based on the currently-registered extensions. static internal AudioSourceExtension AddAmbisonicDecoderExtension(AudioSource source) { if (source.ambisonicExtension != null) { return(source.ambisonicExtension); } RegisterBuiltinDefinitions(); foreach (AudioAmbisonicExtensionDefinition extensionDefinition in m_SourceAmbisonicDecoderExtensionDefinitions) { if (AudioSettings.GetAmbisonicDecoderPluginName() == extensionDefinition.ambisonicPluginName) { AudioSourceExtension newExtension = source.AddAmbisonicExtension(extensionDefinition.definition.GetExtensionType()); if (newExtension != null) { newExtension.audioSource = source; source.ambisonicExtension = newExtension; return(newExtension); } } } return(null); }