public override void OnStkInitialized(SoundToolKitManager soundToolKitManager) { if (!Initialized) { // <STK.LITE> // Warning: Modifying this code may result in plugin instability and frequent crashes to desktop. // This is the SoundToolKit Lite version. // Internally only three SoundSources can be created simultaneously, so circumventing this check will not result // in a possibility of creating more sound sources - only more references to the same source. if (soundToolKitManager.ResourceContainer.AudioSources.Count >= StkLite.AvailableSources()) { SoundToolKitDebug.Log("Only three SoundSources are available simultaneously in the SoundToolKit " + "Lite version. Deleting the illegal SoundSource components at GameObject " + gameObject.name); Destroy(this); return; } // </STK.LITE> SoundToolKitDebug.Assert(soundToolKitManager.StkAudioEngine != null, "AudioEngine is not initialized."); var audioEngine = soundToolKitManager.StkAudioEngine; m_ambientSoundSource = audioEngine.ResourcesFactory.CreateAmbientSoundSource(); UpdateSourceProperties(); soundToolKitManager.ResourceContainer.Add(audioSource: this); m_playbackComponent = new PlaybackComponent(m_ambientSoundSource); m_playbackComponent.InitializeInternalPlaybacks(Playbacks); m_playbackComponent.PlayOnAwake(Playbacks, gameObject.activeSelf, isActiveAndEnabled); Initialized = true; } }
public void Add(SoundToolKitPlayback playback) { // <STK.LITE> - What's the point of it all? if (Playbacks.Count >= StkLite.AvailableSources()) { return; } // </STK.LITE> SoundToolKitDebug.Assert(playback != null, "Playback is null"); if (!Playbacks.Contains(playback)) { m_playbacks.Add(playback); } else { SoundToolKitDebug.LogWarning("Playback already registered."); } }
public void Add(SourceComponent audioSource) { // <STK.LITE> - Why are we even here? if (AudioSources.Count >= StkLite.AvailableSources()) { return; } // </STK.LITE> SoundToolKitDebug.Assert(audioSource != null, "Source component is null"); if (!AudioSources.Contains(audioSource)) { m_audioSources.Add(audioSource); } else { SoundToolKitDebug.LogWarning("Source component already registered."); } }