예제 #1
0
    IEnumerator Start()
    {
        if (SubMenu.gameObject.activeSelf)
        {
            SubMenu.gameObject.SetActive(false);
        }

        if (CalibrationMenu.gameObject.activeSelf)
        {
            CalibrationMenu.gameObject.SetActive(false);
        }

        if (SaveDeleteLoadMenu.gameObject.activeSelf)
        {
            SaveDeleteLoadMenu.gameObject.SetActive(false);
        }

        firstNote = GameObject.FindGameObjectWithTag("FirstNote").GetComponent <Transform>();

        keyboard = GameObject.FindGameObjectWithTag("KeyBoard").GetComponent <Transform>();

        song = MidiFileLoader.Load(sourceFile.bytes);

        yield return(new WaitForSeconds(1.0f));
        //ResetAndPlay ();
    }
예제 #2
0
    IEnumerator Start()
    {
        song = MidiFileLoader.Load(sourceFile.bytes);
        yield return(new WaitForSeconds(1.0f));

        ResetAndPlay();
    }
예제 #3
0
 void Start()
 {
     songs      = new MidiFileContainer[midiFiles.Length];
     sequencers = new List <MidiTrackSequencer> ();
     if (playMasterMusic)
     {
         AudioSource a = gameObject.AddComponent <AudioSource> () as AudioSource;
         a.clip   = masterMusic;
         a.volume = volume;
     }
     else
     {
         for (int i = 0; i < audioFiles.Length; ++i)
         {
             AudioSource a = gameObject.AddComponent <AudioSource> () as AudioSource;
             a.clip   = audioFiles [i];
             a.volume = volume;
         }
     }
     for (int i = 0; i < midiFiles.Length; ++i)
     {
         songs [i] = MidiFileLoader.Load(midiFiles [i].bytes);
     }
     if (playOnAwake)
     {
         ResetAndPlay();
     }
 }
예제 #4
0
 private void LoadSong()
 {
     if (MidiFile != null)
     {
         m_song = MidiFileLoader.Load(MidiFile.bytes);
     }
 }
예제 #5
0
    public void Init()
    {
        song = MidiFileLoader.Load(sourceFile.bytes);
        seq  = new MidiTrackSequencer(song.tracks[0], song.division, bpm);

        // Debug.Log(seq.GetDuration());
    }
예제 #6
0
 public void Init()
 {
     song = MidiFileLoader.Load(sourceFile.bytes);
     seq  = new MidiTrackSequencer(song.tracks[0], song.division, bpm);
     Kick.Init();
     Snare.Init();
     Hat.Init();
 }
    void ConvertMidi()
    {
        Debug.Log("tried o well");
        MidiFileContainer midiFile = MidiFileLoader.Load(File.ReadAllBytes(MidiPath));

        display = midiFile;
        Debug.Log(display.tracks[0].MidiEventPairs[0].midiEvent.data1);
    }
예제 #8
0
		// Use this for initialization
		IEnumerator Start ()
		{
			hammersDict_ = new Dictionary<Hammer.NOTE, Hammer> ();
			foreach (Hammer hammer in FindObjectsOfType<Hammer>()) {
				hammersDict_ [hammer.getNote ()] = hammer;
			}
			song = MidiFileLoader.Load (sourceMidiFile.bytes);
			yield return new WaitForSeconds (1.0f);
			ResetAndPlay ();
		}
예제 #9
0
    // Use this for initialization
    void Start()
    {
        //var bytes = File.ReadAllBytes(@"single_paradiddle");

        //TextAsset ta = Resources.Load("single_paradiddle",typeof(TextAsset)) as TextAsset;
        //Object midifile = Resources.Load("single_paradiddle");
        //Debug.Log(ta);
        MidiFileContainer song = MidiFileLoader.Load(midiFile.bytes);

        seq = new MidiTrackSequencer(song.tracks[0], song.division, 120);

        foreach (MidiEvent e in seq.Start())
        {
            // Do something with a MidiEvent.
            Debug.Log(e);
        }
    }
예제 #10
0
        public NoteList Read(string path)
        {
            var smf = MidiFileLoader.Load(File.ReadAllBytes(path));

            var conductorTrack = smf.tracks[0];
            var noteTrack      = smf.tracks[1];

            var tempoMap         = new TempoMap(smf.division);
            var timeSignatureMap = new TimeSignatureMap(smf.division);

            ParseConductorTrack(conductorTrack, tempoMap, timeSignatureMap);

            var noteList = new NoteList(tempoMap, timeSignatureMap);

            ParseNoteTrack(smf, noteTrack, noteList);

            return(noteList);
        }
예제 #11
0
    /// <summary>
    /// Load the specified midiFile with tempo (bpm).
    /// </summary>
    public void Load(TextAsset midiFile, float bpm = -1)
    {
        if (_isPlaying)
        {
            _multiSequencer = null;
            _isPlaying      = false;
        }

        if (bpm != -1)
        {
            _midiFileTempo = bpm;
        }

        _midiFile = midiFile;
        MidiFileContainer song = MidiFileLoader.Load(_midiFile.bytes);

        _multiSequencer = new MidiMultiTrackSequencer(song, _midiFileTempo);
        _isLoaded       = true;

        MidiFileInfo info = _multiSequencer.info;

        _onLoadedEvent.Invoke(midiFile, info);
    }
예제 #12
0
 public void Init()
 {
     m_song = MidiFileLoader.Load(m_midiFile.bytes);
 }