/// <summary> /// TempoTableの[*].Timeの部分を更新します /// </summary> /// <returns></returns> public void updateTempoInfo() { if (m_tempo_table == null) { m_tempo_table = new List <TempoTableEntry>(); } else { m_tempo_table.Clear(); } if (m_tracks.Count <= 0) { return; } int clock = 0; double time = 0.0; int last_tempo_clock = 0; //最後にTempo値が代入されていたイベントのクロック float last_tempo = m_tempo; //最後に代入されていたテンポの値 UstTrack ust_track = m_tracks[0]; for (int i = 0; i < ust_track.getEventCount(); i++) { UstEvent itemi = ust_track.getEvent(i); if (ust_track.getEvent(i).isTempoSpecified()) { time += (clock - last_tempo_clock) / (8.0 * last_tempo); if (m_tempo_table.Count == 0 && clock != 0) { m_tempo_table.Add(new TempoTableEntry(0, (int)(6e7 / m_tempo), 0.0)); } m_tempo_table.Add(new TempoTableEntry(clock, (int)(6e7 / itemi.getTempo()), time)); last_tempo = itemi.getTempo(); last_tempo_clock = clock; } clock += (int)itemi.getLength(); } }