//************************************************************************ BOOL CGBScene::PlaySound(LPCTSTR lpWaveFile, BOOL fHint) //************************************************************************ { LPSOUND pSound = GetSound(); if ( !pSound ) return( FALSE ); BOOL fRet; if ( !pSound->IsMixing() ) fRet = pSound->StartFile((LPSTR)lpWaveFile, FALSE/*bLoop*/, -1, TRUE/*bWait*/); else { // this nonsense is here because in order to make buttons // in action strip play the click wave when they are clicked // on we need to synchronously play the sound so the click // happens while the button is down. WaveMix does not play // sounds synchronously, so we deactivate WaveMix and use // sndPlaySound stuff. CSound sound; pSound->Activate(FALSE); fRet = sound.StartFile((LPSTR)lpWaveFile, FALSE/*bLoop*/, -1, TRUE/*bWait*/); pSound->Activate(TRUE); } return(fRet); }
//************************************************************************ void CNutDropScene::PlayClickWave (BOOL fSync/*=TRUE*/) //************************************************************************ { FNAME szFileName; // Play synchronously ? if (fSync) { CSound sound; if (m_pSound) { m_pSound->StopAndFree(); m_pSound->Activate (FALSE); } if (GetToon()->FindContent (CLICK_WAVE, TRUE, szFileName)) sound.StartFile (szFileName, NO/*bLoop*/, -1, TRUE); if (m_pSound) m_pSound->Activate (TRUE); } else if (m_pSound) { m_pSound->StopAndFree(); if (GetToon()->FindContent (CLICK_WAVE, TRUE, szFileName)) m_pSound->StartFile (szFileName, FALSE, HINT_CHANNEL, TRUE); } }