//stop the redbook, so we can read off the CD void songs_stop_redbook(void) { int old_volume = GameCfg.MusicVolume*REDBOOK_VOLUME_SCALE/8; fix old_time = timer_get_fixed_seconds(); if (Redbook_playing) { //fade out volume int new_volume; do { fix t = timer_get_fixed_seconds(); new_volume = fixmuldiv(old_volume,(FADE_TIME - (t-old_time)),FADE_TIME); if (new_volume < 0) new_volume = 0; RBASetVolume(new_volume); } while (new_volume > 0); } RBAStop(); // Stop CD, if playing RBASetVolume(old_volume); //restore volume Redbook_playing = 0; }
//stop any songs - builtin, redbook or jukebox - that are currently playing void songs_stop_all(void) { #ifdef _WIN32 digi_win32_stop_midi_song(); // Stop midi song, if playing #endif RBAStop(); #ifdef USE_SDLMIXER mix_stop_music(); #endif Song_playing = -1; }
int main() { fix fsecs; int oldmin=-1, oldsec=-1; error_init(NULL, NULL); dpmi_init(0); timer_init(); key_init(); RBAInit(); RBARegisterCD(); RBAPlayTrack(2); fsecs = timer_get_fixed_seconds(); do { int min, sec, frame; long headloc; if ((timer_get_fixed_seconds() - fsecs) >= F2_0) { headloc = RBAGetHeadLoc(&min, &sec, &frame); printf("Head loc: %d (%d:%d:%d)\n", headloc, min, sec, frame); if (min==oldmin && sec==oldsec) { printf("\nRepeating track..\n"); RBAPlayTrack(2); } oldmin = min; oldsec = sec; fsecs = timer_get_fixed_seconds(); } if (key_inkey()) { RBAStop(); printf("\nCD stopped.\n"); break; } } while (1); key_close(); timer_close(); return 0; }
//stop the redbook, so we can read off the CD void songs_stop_redbook(void) { int old_volume = gameConfig.nRedbookVolume*REDBOOK_VOLUME_SCALE/8; fix old_time = TimerGetFixedSeconds(); if (gameStates.sound.bRedbookPlaying) { //fade out volume int new_volume; do { fix t = TimerGetFixedSeconds(); new_volume = fixmuldiv(old_volume,(FADE_TIME - (t-old_time)),FADE_TIME); if (new_volume < 0) new_volume = 0; RBASetVolume(new_volume); } while (new_volume > 0); } RBAStop(); // Stop CD, if playing RBASetVolume(old_volume); //restore volume gameStates.sound.bRedbookPlaying = 0; }