void OPLmusicBlock::Restart () { OPLstopMusic (); OPLplayMusic (); MLtime = 0; playingcount = 0; if (RawPlayer == NotRaw) { score = scoredata + ((MUSheader *)scoredata)->scoreStart; } else if (RawPlayer == RDosPlay) { score = scoredata + 10; SamplesPerTick = Scale (SampleRate, SHORT(*(WORD *)(scoredata + 8)), 1193180); } else if (RawPlayer == IMF) { score = scoredata + 6; // Skip track and game name for (int i = 2; i != 0; --i) { while (*score++ != '\0') {} } score++; // Skip unknown byte if (*(DWORD *)score != 0) { score += 4; // Skip song length } } }
int OPLMIDIDevice::Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata) { if (io == NULL || io->OPLinit(TwoChips + 1)) { return 1; } Stream = GSnd->CreateStream(FillStream, int(OPL_SAMPLE_RATE / 14) * 4, SoundStream::Mono | SoundStream::Float, int(OPL_SAMPLE_RATE), this); if (Stream == NULL) { return 2; } Callback = callback; CallbackData = userdata; Tempo = 500000; Division = 100; CalcTickRate(); OPLstopMusic(); OPLplayMusic(100); DEBUGOUT("========= New song started ==========\n", 0, 0, 0); return 0; }
void OPLmusicBlock::Restart() { OPLstopMusic (); OPLplayMusic (127); MLtime = 0; playingcount = 0; LastOffset = 0; }
int OPLMIDIDevice::Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata) { if (io == NULL || 0 == (NumChips = io->OPLinit(opl_numchips, FullPan, true))) { return 1; } int ret = OpenStream(14, (FullPan || io->IsOPL3) ? 0 : SoundStream::Mono, callback, userdata); if (ret == 0) { OPLstopMusic(); OPLplayMusic(100); DEBUGOUT("========= New song started ==========\n", 0, 0, 0); } return ret; }