Ejemplo n.º 1
0
 protected virtual void Awake()
 {
     try
     {
         HelperNoteLabel.Init();
         //MidiPlayerGlobal.Init();
         audiosources = new List <AudioSource>();
     }
     catch (System.Exception ex)
     {
         MidiPlayerGlobal.ErrorDetail(ex);
     }
 }
Ejemplo n.º 2
0
        //public static void InitPath()
        //{
        //    if (string.IsNullOrEmpty(MPTK_PathToResources))
        //        Debug.Log("MPTK_PathToResources not defined");
        //    else
        //    {
        //        PathToSoundfonts = MPTK_PathToResources + SoundfontsDB;
        //        PathToMidiFile = MPTK_PathToResources + MidiFilesDB;
        //        PathToMidiSet = MPTK_PathToResources + FilenameMidiSet + ExtensionSoundFileDot;
        //    }
        //}

        void Awake()
        {
            HelperNoteLabel.Init();

            //Debug.Log("Awake MidiPlayerGlobal");
            if (instance != null && instance != this)
            {
                Destroy(gameObject);    // remove previous instance
            }
            else
            {
                //DontDestroyOnLoad(gameObject);
                instance = this;
                Routine.RunCoroutine(instance.InitThread(), Segment.RealtimeUpdate);
            }

            InitPath();
        }
Ejemplo n.º 3
0
 private MidiPlayerGlobal()
 {
     HelperNoteLabel.Init();
 }
Ejemplo n.º 4
0
        private void LogInfoSample(MidiNote note, ImSample sample, string info = null)
        {
            //TimeSpan playtime = TimeSpan.Zero;
            //if (miditoplay != null) playtime = miditoplay.CurrentMidiTime();

            //string time = string.Format("[{0:00}:{1:00}:{2:00}:{3:000}]", playtime.Hours, playtime.Minutes, playtime.Seconds, playtime.Milliseconds);
            string time = "";

            if (sample != null)
#if DEBUGPITCHNOTE
            { Debug.Log(string.Format("{0} C:{1,2} P:{2,3:000} D:{3} Note:{4,3:000} OriginalPitch:{5} PitchCorrection:{6} FineTune:{7} CoarseTune:{8} Duration:{9,4} sec. Velocity:{10} Wave:{11}",
                                      time, note.Chanel, note.Patch, note.Drum, note.Midi,
                                      sample.OriginalPitch, sample.PitchCorrection, sample.FineTune, sample.CoarseTune, Math.Round(note.Duration / 1000d, 2), note.Velocity, sample.WaveFile)); }
#else
            { Debug.Log(string.Format("{0} C:{1,2} P:{2,3:000} D:{3} Note:{4,3:000} {5,-3} Duration:{6,4} sec. Velocity:{7} Pan:{8} Wave:{9}",
                                      time, note.Channel, note.Patch, note.Drum, note.Midi, HelperNoteLabel.LabelFromMidi(note.Midi),
                                      Math.Round(note.Duration / 1000d, 2), note.Velocity, sample.Pan, sample.WaveFile)); }