Ejemplo n.º 1
0
 /// <summary>
 /// Load Simplified SoundFont from OS (edit mode)
 /// </summary>
 /// <param name="soundPath"></param>
 /// <param name="soundFontName"></param>
 public static void LoadImSF(string soundPath = null, string soundFontName = null)
 {
     try
     {
         if (soundPath == null || soundFontName == null)
         //Load active SF
         {
             if (MidiPlayerGlobal.CurrentMidiSet.ActiveSounFontInfo != null)
             {
                 soundPath     = Path.Combine(Application.dataPath + "/", MidiPlayerGlobal.PathToSoundfonts);
                 soundPath     = Path.Combine(soundPath + "/", MidiPlayerGlobal.CurrentMidiSet.ActiveSounFontInfo.Name);
                 soundFontName = MidiPlayerGlobal.CurrentMidiSet.ActiveSounFontInfo.Name;
             }
         }
         if (soundPath != null && soundFontName != null)
         {
             Debug.Log("SoundFont loading " + soundFontName);
             MidiPlayerGlobal.ImSFCurrent = ImSoundFont.Load(soundPath, soundFontName);
             MidiPlayerGlobal.ImSFCurrent.CreateBankDescription();
             MidiPlayerGlobal.BuildPresetList();
             MidiPlayerGlobal.BuildDrumList();
         }
         else
         {
             Debug.Log("LoadImSF : no sf defined");
         }
     }
     catch (System.Exception ex)
     {
         MidiPlayerGlobal.ErrorDetail(ex);
     }
 }