MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / Frame

Method Frame

music/sequencer.cpp:283–341  ·  view source on GitHub ↗

runs a frame of input.

Source from the content-addressed store, hash-verified

281
282// runs a frame of input.
283void OutrageMusicSeq::Frame(float frame_time) {
284 bool start_pending_song = false;
285 int i;
286
287 // run check.
288 if (!m_sequencer_run)
289 return;
290
291 // close all streams that aren't the dominant one and have stopped playing
292 for (i = 0; i < OMS_NUM_STRM; i++) {
293 if ((&m_strm[i]) != (&m_strm[m_dominant_strm])) {
294 if (m_strm[i].m_stream.State() == STRM_STOPPED) {
295 m_strm[i].m_stream.Close();
296 }
297 }
298 }
299
300 // determine when to start song if a song is pending.
301 if (!m_active_song && m_pending_song) {
302 start_pending_song = true;
303 }
304
305 if (m_pending_song) {
306 if (m_pending_song->immediate_switch == true) {
307 start_pending_song = true;
308 } else if (m_active_song) {
309 if (m_active_song->stream_idle) {
310 // this will transfer the current song's steam to the pending one, so the
311 // ExecScript function can manage these streams.
312 start_pending_song = true;
313 } else if (!m_active_song->request_stop) {
314 m_active_song->request_stop = true;
315 }
316 }
317 }
318
319 if (start_pending_song) {
320 mprintf(0, "MUSIC:Starting pending song.\n");
321 LOGFILE((_logfp, "MUSIC:Starting pending song.\n"));
322 START_PENDING_SONG();
323 }
324
325 // execute song code
326 ExecScript(m_active_song);
327
328 // process streams, starting at dominant stream.
329 // this is vital to ensure that the dominant stream's commands are executed before any
330 // other streams.
331 // i = m_dominant_strm;
332 // do
333 // {
334 // m_strm[i].Process(frame_time);
335 // i++;
336 // if (i == OMS_NUM_STRM) i = 0;
337 // }
338 // while (i != m_dominant_strm);
339
340 m_timer += frame_time;

Callers 1

D3MusicDoFrameFunction · 0.45

Calls 2

StateMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected