Пример #1
0
        public void OnStkInitialized(SoundToolKitManager soundToolKitManager)
        {
            if (!Initialized)
            {
                SoundToolKitDebug.Assert(soundToolKitManager.StkAudioEngine != null, "Audio engine is not initialized. Logical error.");

                m_acousticMesh      = soundToolKitManager.StkAudioEngine.ResourcesFactory.CreateMesh();
                m_acousticMesh.Name = gameObject.name;

                UpdateProperties();

                var mesh = GetComponent <MeshFilter>().mesh;
                if (mesh != null)
                {
                    Mesh = mesh;
                }
                else
                {
                    SoundToolKitDebug.LogWarning("UnityEngine.Mesh not present in this component. Cannot AutoRegister.");
                }

                soundToolKitManager.ResourceContainer.Add(acousticMesh: this);

                if (soundToolKitManager.ResourceContainer.Geometry != null && MeshCluster == null)
                {
                    MeshCluster = soundToolKitManager.ResourceContainer.Geometry.GetTemporaryMeshCluster();
                }

                Initialized = true;
            }
        }
Пример #2
0
        public void OnStkInitialized(SoundToolKitManager soundToolKitManager)
        {
            if (!Initialized)
            {
                SoundToolKitDebug.Assert(soundToolKitManager.StkAudioEngine != null, "Audio engine is not initialized. Logical error.");

                m_stkStatus = soundToolKitManager.StkAudioEngine.Control;

                SerializedLogs = SoundToolKitManager.Instance.UncacheLogs();
                SoundToolKitManager.Instance.OnLogAdded += OnLogEntryAdded;

                m_stkStatus.OnIndicatorAdded += (indicator, indicatorValue) =>
                {
                    SerializedStatusIndicators.Add(new SerializedStatusIndicator(indicator, indicatorValue));
                };

                m_stkStatus.OnIndicatorRemoved += (indicator) =>
                {
                    SerializedStatusIndicators.Remove(SerializedStatusIndicators.FirstOrDefault(
                                                          x => x.Name == indicator.Name));
                };

                SoundToolKitManager.Instance.ResourceContainer.Status = this;
                Initialized = true;
            }
        }
        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;
            }
        }
Пример #4
0
        public void OnStkInitialized(SoundToolKitManager soundToolKitManager)
        {
            UnityEngine.SceneManagement.SceneManager.sceneLoaded += (scene, loadSceneMode) =>
            {
                InitializeMeshClusters();
            };

            SoundToolKitManager.Instance.ResourceContainer.Geometry = this;
        }
Пример #5
0
        public override void OnStkInitialized(SoundToolKitManager soundToolKitManager)
        {
            if (!Initialized)
            {
                base.OnStkInitialized(soundToolKitManager);

                m_playbackComponent = new PlaybackComponent(m_spatialSoundSource);

                m_playbackComponent.InitializeInternalPlaybacks(Playbacks);
                m_playbackComponent.PlayOnAwake(Playbacks, gameObject.activeSelf, isActiveAndEnabled);

                Initialized = true;
            }
        }
Пример #6
0
        public void OnStkInitialized(SoundToolKitManager soundToolKitManager)
        {
            if (!Initialized)
            {
                SoundToolKitDebug.Assert(soundToolKitManager.StkAudioEngine != null, "Audio engine is not initialized. Logical error.");

                UpdateDamping(DampingCoefficients);
                DampingCoefficients.OnCoefficientsChanged += UpdateDamping;

                SoundToolKitManager.Instance.ResourceContainer.SceneConfiguration = this;
                Initialized = true;
                UpdateProperties();
            }
        }
Пример #7
0
        public void OnStkInitialized(SoundToolKitManager soundToolKitManager)
        {
            if (!Initialized)
            {
                SoundToolKitDebug.Assert(soundToolKitManager.StkAudioEngine != null, "AudioEngine is null");

                m_receiver = soundToolKitManager.StkAudioEngine.Scene.Receiver;
                SoundToolKitDebug.Assert(m_receiver != null, "Receiver is null");

                soundToolKitManager.ResourceContainer.AudioListener = this;

                SubscribeOnTransformChanged(m_receiver);

                Initialized = true;
            }
        }
        public override void OnStkInitialized(SoundToolKitManager soundToolKitManager)
        {
            if (!Initialized)
            {
                base.OnStkInitialized(soundToolKitManager);

                var resourcesFactory = SoundToolKitManager.Instance.StkAudioEngine.ResourcesFactory;

                m_streamingSample = resourcesFactory.CreateSampleStreaming(channelCount: STK_UNITY_STREAMING_SAMPLE_CHANNELS);

                if (m_spatialSoundSource != null)
                {
                    Playback = resourcesFactory.CreatePlayback(m_streamingSample, m_spatialSoundSource);
                }

                Initialized = true;
            }
        }
Пример #9
0
        public void OnStkInitialized(SoundToolKitManager soundToolKitManager)
        {
            if (!Initialized)
            {
                SoundToolKitDebug.Assert(soundToolKitManager.StkAudioEngine != null, "AudioEngine is not initialized.");
                var audioEngine = soundToolKitManager.StkAudioEngine;
                m_toolkit = new AiToolKit(audioEngine);

                SoundToolKitDebug.Assert(m_toolkit != null, "SoundToolKitAI is not initialized.");
                if (m_toolkit != null)
                {
                    SoundToolKitDebug.Log("SoundToolKitAI intialized.");
                    m_toolkit.StopAnalysis();
                    m_analysisEnabled           = m_toolkit.AnalysisEnabled();
                    m_energyThreshold           = m_toolkit.EnergyThreshold;
                    m_analyseAllSources         = false;
                    m_wasAnalysisOnBeforeChange = false;
                }
                Initialized = true;
            }
        }
Пример #10
0
 public abstract void OnStkInitialized(SoundToolKitManager soundToolKitManager);