void MIDISong2 :: DoRestart() { int i; // Set initial state. for (i = 0; i < NumTracks; ++i) { Tracks[i].TrackP = 0; Tracks[i].Finished = false; Tracks[i].RunningStatus = 0; Tracks[i].Designated = false; Tracks[i].Designation = 0; Tracks[i].LoopCount = -1; Tracks[i].EProgramChange = false; Tracks[i].EVolume = false; Tracks[i].PlayedTime = 0; } ProcessInitialMetaEvents (); for (i = 0; i < NumTracks; ++i) { Tracks[i].Delay = Tracks[i].ReadVarLen(); } TrackDue = Tracks; TrackDue = FindNextDue(); }
DWORD MIDISong2::SendCommands () { while (TrackDue && TrackDue->Delay == 0) { SendCommand (TrackDue); TrackDue = FindNextDue (); } return TrackDue ? TrackDue->Delay : 0; }
void XMISong::DoRestart() { CurrSong->EventP = 0; CurrSong->Finished = false; CurrSong->PlayedTime = 0; CurrSong->ForDepth = 0; NoteOffs.Clear(); ProcessInitialMetaEvents (); CurrSong->Delay = CurrSong->ReadDelay(); EventDue = FindNextDue(); }
DWORD *MIDISong2::MakeEvents(DWORD *events, DWORD *max_event_p, DWORD max_time) { DWORD *start_events; DWORD tot_time = 0; DWORD time = 0; DWORD delay; start_events = events; while (TrackDue && events < max_event_p && tot_time <= max_time) { // It's possible that this tick may be nothing but meta-events and // not generate any real events. Repeat this until we actually // get some output so we don't send an empty buffer to the MIDI // device. do { delay = TrackDue->Delay; time += delay; // Advance time for all tracks by the amount needed for the one up next. tot_time += delay * Tempo / Division; AdvanceTracks(delay); // Play all events for this tick. do { bool sysex_noroom = false; DWORD *new_events = SendCommand(events, TrackDue, time, max_event_p - events, sysex_noroom); if (sysex_noroom) { return events; } TrackDue = FindNextDue(); if (new_events != events) { time = 0; } events = new_events; } while (TrackDue && TrackDue->Delay == 0 && events < max_event_p); } while (start_events == events && TrackDue); time = 0; } return events; }
uint32_t *XMISong::MakeEvents(uint32_t *events, uint32_t *max_event_p, uint32_t max_time) { uint32_t *start_events; uint32_t tot_time = 0; uint32_t time = 0; uint32_t delay; start_events = events; while (EventDue != EVENT_None && events < max_event_p && tot_time <= max_time) { // It's possible that this tick may be nothing but meta-events and // not generate any real events. Repeat this until we actually // get some output so we don't send an empty buffer to the MIDI // device. do { delay = GET_DELAY; time += delay; // Advance time for all tracks by the amount needed for the one up next. tot_time += delay * Tempo / Division; AdvanceSong(delay); // Play all events for this tick. do { bool sysex_noroom = false; uint32_t *new_events = SendCommand(events, EventDue, time, max_event_p - events, sysex_noroom); if (sysex_noroom) { return events; } EventDue = FindNextDue(); if (new_events != events) { time = 0; } events = new_events; } while (EventDue != EVENT_None && GET_DELAY == 0 && events < max_event_p); } while (start_events == events && EventDue != EVENT_None); time = 0; } return events; }
uint32_t *HMISong::MakeEvents(uint32_t *events, uint32_t *max_event_p, uint32_t max_time) { uint32_t *start_events; uint32_t tot_time = 0; uint32_t time = 0; uint32_t delay; start_events = events; while (TrackDue && events < max_event_p && tot_time <= max_time) { // It's possible that this tick may be nothing but meta-events and // not generate any real events. Repeat this until we actually // get some output so we don't send an empty buffer to the MIDI // device. do { delay = TrackDue->Delay; time += delay; // Advance time for all tracks by the amount needed for the one up next. tot_time += delay * Tempo / Division; AdvanceTracks(delay); // Play all events for this tick. do { uint32_t *new_events = SendCommand(events, TrackDue, time); TrackDue = FindNextDue(); if (new_events != events) { time = 0; } events = new_events; } while (TrackDue && TrackDue->Delay == 0 && events < max_event_p); } while (start_events == events && TrackDue); time = 0; } return events; }
void HMISong :: DoRestart() { int i; // Set initial state. FakeTrack = &Tracks[NumTracks]; NoteOffs.Clear(); for (i = 0; i <= NumTracks; ++i) { Tracks[i].TrackP = 0; Tracks[i].Finished = false; Tracks[i].RunningStatus = 0; Tracks[i].PlayedTime = 0; } ProcessInitialMetaEvents (); for (i = 0; i < NumTracks; ++i) { Tracks[i].Delay = ReadVarLen(&Tracks[i]); } Tracks[i].Delay = 0; // for the FakeTrack Tracks[i].Enabled = true; TrackDue = Tracks; TrackDue = FindNextDue(); }