private static void LoadSoundFont() { if (MidiPlayerGlobal.ImSFCurrent != null) { Debug.Log("Load MidiPlayerGlobal.ImSFCurrent: " + MidiPlayerGlobal.ImSFCurrent.SoundFontName); Debug.Log("Load CurrentMidiSet.ActiveSounFontInfo: " + CurrentMidiSet.ActiveSounFontInfo.Name); MidiPlayerGlobal.SoundFontLoaded = false; MidiPlayerGlobal.LoadCurrentSF(); Debug.Log("Time To Load SoundFont: " + Math.Round(MidiPlayerGlobal.MPTK_TimeToLoadSoundFont.TotalSeconds, 3).ToString() + " second"); if (Application.isPlaying) { Debug.Log("Time To Load Waves: " + Math.Round(MidiPlayerGlobal.MPTK_TimeToLoadWave.TotalSeconds, 3).ToString() + " second"); } MidiPlayerGlobal.SoundFontLoaded = true; } }
private static IEnumerator LoadSoundFontThread() { if (MidiPlayerGlobal.ImSFCurrent != null) { Debug.Log("Load MidiPlayerGlobal.ImSFCurrent: " + MidiPlayerGlobal.ImSFCurrent.SoundFontName); Debug.Log("Load CurrentMidiSet.ActiveSounFontInfo: " + CurrentMidiSet.ActiveSounFontInfo.Name); MidiPlayerGlobal.SoundFontLoaded = false; MidiPlayer[] midiplayers = null; if (Application.isPlaying) { midiplayers = GameObject.FindObjectsOfType <MidiPlayer>(); if (midiplayers != null) { foreach (MidiPlayer mp in midiplayers) { //if (mp is MidiFilePlayer) ((MidiFilePlayer)mp).MPTK_Pause(); yield return(Instance.StartCoroutine(mp.MPTK_ClearAllSound(true))); } } //return; DicAudioClip.Init(); } MidiPlayerGlobal.LoadCurrentSF(); Debug.Log(" Time To Load SoundFont: " + Math.Round(MidiPlayerGlobal.MPTK_TimeToLoadSoundFont.TotalSeconds, 3).ToString() + " second"); Debug.Log(" Time To Load Waves: " + Math.Round(MidiPlayerGlobal.MPTK_TimeToLoadWave.TotalSeconds, 3).ToString() + " second"); MidiPlayerGlobal.SoundFontLoaded = true; if (Application.isPlaying) { if (midiplayers != null) { foreach (MidiPlayer mp in midiplayers) { if (mp is MidiFilePlayer) { ((MidiFilePlayer)mp).MPTK_ReSyncTime(); } } } } } }