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

Method ExecScript

music/sequencer.cpp:344–570  ·  view source on GitHub ↗

music kernal.

Source from the content-addressed store, hash-verified

342
343// music kernal.
344void OutrageMusicSeq::ExecScript(music_stream *strm) {
345 if (!strm)
346 return;
347
348// get command
349next_ins:
350 music_ins *cur_ins = &strm->ins[strm->ip];
351 uint8_t cmd = cur_ins->cmd;
352 tMusicVal val = cur_ins->opr.num;
353 char *str = cur_ins->opr.str;
354 const char *name;
355
356 // goto next instruction.
357 strm->ip++;
358
359 // mprintf(0, "%d ", cmd);
360 AudioStream *stream = &strm->strm->m_stream;
361
362 // execute opcodes.
363 // if (strm->last_ip != strm->ip) {
364 // LOGFILE((_logfp, "ins=%d\n", cmd));
365 // }
366 strm->last_ip = strm->ip;
367
368 switch (cmd) {
369 case OMFCMD_PLAY:
370 name = m_tracklist.get(strm->ln_reg);
371 if (name) {
372 // close this song's stream.
373 bool err = false;
374
375 strm->old_strm = strm->strm;
376
377 strm->error = false;
378
379 if (strm->immediate_switch) {
380 // we start playing the current stream immediately.
381 stream->Close();
382 m_dominant_strm = DOMINANT_STRM_ADJUST();
383 // mprintf(0, "MUSIC: Starting stream with %s on channel %d.\n", name, m_dominant_strm);
384 LOGFILE((_logfp, "MUSIC: Starting stream with %s on channel %d.\n", name, m_dominant_strm));
385 strm->strm = &m_strm[m_dominant_strm];
386 stream = &strm->strm->m_stream;
387 err = stream->Open(name);
388 } else {
389 m_dominant_strm = DOMINANT_STRM_ADJUST();
390 // mprintf(0, "MUSIC: Preparing stream with %s on channel %d.\n", name, m_dominant_strm);
391 LOGFILE((_logfp, "MUSIC: Preparing stream with %s on channel %d.\n", name, m_dominant_strm));
392 strm->strm = &m_strm[m_dominant_strm];
393 stream = &strm->strm->m_stream;
394 err = stream->Open(name);
395 // stream->Open(name, STRM_OPNF_GRADUAL);
396 }
397
398 // skip instructions until error is cleared.
399 if (!err) {
400 // mprintf(0, "MUSIC: Error opening stream %s on channel %d.\n", name, m_dominant_strm);
401 LOGFILE((_logfp, "MUSIC: Error opening stream %s on channel %d.\n", name, m_dominant_strm));

Callers

nothing calls this directly

Calls 12

SetLoopCountMethod · 0.80
IsReadyMethod · 0.80
StateMethod · 0.80
ReadAheadFinishedLoopMethod · 0.80
ReadAheadMethod · 0.80
getMethod · 0.45
CloseMethod · 0.45
OpenMethod · 0.45
SetVolumeMethod · 0.45
PlayMethod · 0.45
sendMethod · 0.45
StopMethod · 0.45

Tested by

no test coverage detected