private void SaveAt(MuseReciever reciever, string path) { if (string.IsNullOrEmpty(path)) { return; } if (reciever.Tokens == 0) { return; } MidiAsset asset = MidiAsset.CreateInstance <MidiAsset>(); asset.MidiFile = MuseDecoder.DecodeMuseEncoding(reciever.EncodedMidi); //int i = 1; //string org = Path.GetDirectoryName(path) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(path); //string ext = Path.GetExtension(path); //while (File.Exists(path)) { // path = org + i + ext; // i++; // } if (File.Exists(path)) { File.Delete(path); } AssetDatabase.CreateAsset(asset, path); }
public void Play() { //Debug.Log("Play L: "+encodedMidi.Length); //DebugTask(); MidiPlayer.Play(MuseDecoder.DecodeMuseEncoding(EncodedMidi)); }