| 398 | //----------------------------------------------------------------------------- |
| 399 | |
| 400 | void SoundCore_SetFade(eFADE FadeType) |
| 401 | { |
| 402 | static AppMode_e nLastMode = MODE_UNDEFINED; |
| 403 | |
| 404 | if(g_nAppMode == MODE_DEBUG) |
| 405 | return; |
| 406 | |
| 407 | // Fade in/out for speaker, the others are unmuted/muted here |
| 408 | if(FadeType != FADE_NONE) |
| 409 | { |
| 410 | for(UINT i=0; i<g_uNumVoices; i++) |
| 411 | { |
| 412 | // Note: Kludge for fading speaker if curr/last g_nAppMode is/was MODE_LOGO: |
| 413 | // . Bug in DirectSound? SpeakerVoice.lpDSBvoice->SetVolume() doesn't work without this! |
| 414 | // . See SoundCore_TweakVolumes() - could be this? |
| 415 | if((g_pVoices[i]->bIsSpeaker) && (g_nAppMode != MODE_LOGO) && (nLastMode != MODE_LOGO)) |
| 416 | { |
| 417 | g_pVoices[i]->lpDSBvoice->GetVolume(&g_pVoices[i]->nFadeVolume); |
| 418 | g_FadeType = FadeType; |
| 419 | SoundCore_StartTimer(); |
| 420 | } |
| 421 | else if(FadeType == FADE_OUT) |
| 422 | { |
| 423 | g_pVoices[i]->lpDSBvoice->SetVolume(DSBVOLUME_MIN); |
| 424 | g_pVoices[i]->bMute = true; |
| 425 | } |
| 426 | else // FADE_IN |
| 427 | { |
| 428 | g_pVoices[i]->lpDSBvoice->SetVolume(g_pVoices[i]->nVolume); |
| 429 | g_pVoices[i]->bMute = false; |
| 430 | } |
| 431 | } |
| 432 | } |
| 433 | else // FadeType == FADE_NONE |
| 434 | { |
| 435 | if( (g_FadeType != FADE_NONE) && // Currently fading-in/out |
| 436 | (g_pSpeakerVoice && g_pSpeakerVoice->bActive) ) |
| 437 | { |
| 438 | g_FadeType = FADE_NONE; // TimerFunc will call StopTimer() |
| 439 | g_pSpeakerVoice->lpDSBvoice->SetVolume(g_pSpeakerVoice->nVolume); |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | nLastMode = g_nAppMode; |
| 444 | } |
| 445 | |
| 446 | //----------------------------------------------------------------------------- |
| 447 |
no test coverage detected