| 334 | } |
| 335 | |
| 336 | void operator ()() |
| 337 | { |
| 338 | while (Flc::flc.FrameCount >= introSoundTrack[trackPosition].frameNumber) |
| 339 | { |
| 340 | int command = introSoundTrack[trackPosition].sound; |
| 341 | |
| 342 | if (command & 0x200) |
| 343 | { |
| 344 | #ifndef __NO_MUSIC |
| 345 | switch(command) |
| 346 | { |
| 347 | case 0x200: |
| 348 | Log(LOG_DEBUG) << "Playing gmintro1"; |
| 349 | m = rp->getMusic("GMINTRO1"); |
| 350 | m->play(1); |
| 351 | break; |
| 352 | case 0x201: |
| 353 | Log(LOG_DEBUG) << "Playing gmintro2"; |
| 354 | m = rp->getMusic("GMINTRO2"); |
| 355 | m->play(1); |
| 356 | break; |
| 357 | case 0x202: |
| 358 | Log(LOG_DEBUG) << "Playing gmintro3"; |
| 359 | m = rp->getMusic("GMINTRO3"); |
| 360 | m->play(1); |
| 361 | Mix_HookMusicFinished(musicDone); |
| 362 | break; |
| 363 | } |
| 364 | #endif |
| 365 | } |
| 366 | else if (command & 0x400) |
| 367 | { |
| 368 | Flc::flc.HeaderSpeed = (1000.0/70.0) * (command & 0xff); |
| 369 | Log(LOG_DEBUG) << "Frame delay now: " << Flc::flc.HeaderSpeed; |
| 370 | } |
| 371 | else if (command <= 0x19) |
| 372 | { |
| 373 | for (soundInFile **sounds = introSounds; *sounds; ++sounds) // try hybrid sound set, then intro.cat or sample3.cat alone |
| 374 | { |
| 375 | soundInFile *sf = (*sounds) + command; |
| 376 | int channel = trackPosition % 4; // use at most four channels to play sound effects |
| 377 | double ratio = (double)Options::soundVolume / MIX_MAX_VOLUME; |
| 378 | Log(LOG_DEBUG) << "playing: " << sf->catFile << ":" << sf->sound << " for index " << command; |
| 379 | s = rp->getSound(sf->catFile, sf->sound); |
| 380 | if (s) |
| 381 | { |
| 382 | s->play(channel); |
| 383 | Mix_Volume(channel, sf->volume * ratio); |
| 384 | break; |
| 385 | } |
| 386 | else Log(LOG_DEBUG) << "Couldn't play " << sf->catFile << ":" << sf->sound; |
| 387 | } |
| 388 | } |
| 389 | ++trackPosition; |
| 390 | } |
| 391 | |
| 392 | } |
| 393 | } *audioSequence; |