//------------------------------------------------------------------------------ // Updates the rotor wash volume //------------------------------------------------------------------------------ void CBaseHelicopter::UpdateRotorWashVolume() { if ( !m_pRotorSound ) return; CSoundEnvelopeController &controller = CSoundEnvelopeController::GetController(); float flVolDelta = GetRotorVolume() - controller.SoundGetVolume( m_pRotorSound ); if ( flVolDelta ) { // We can change from 0 to 1 in 3 seconds. // Figure out how many seconds flVolDelta will take. float flRampTime = fabs( flVolDelta ) * 3.0f; controller.SoundChangeVolume( m_pRotorSound, GetRotorVolume(), flRampTime ); } }
//------------------------------------------------------------------------------ // Purpose : // Input : // Output : //------------------------------------------------------------------------------ void CBaseHelicopter::UpdateRotorSoundPitch( int iPitch ) { if (m_pRotorSound) { CSoundEnvelopeController &controller = CSoundEnvelopeController::GetController(); controller.SoundChangePitch( m_pRotorSound, iPitch, 0.1 ); controller.SoundChangeVolume( m_pRotorSound, GetRotorVolume(), 0.1 ); } }
//------------------------------------------------------------------------------ // Purpose : // Input : // Output : //------------------------------------------------------------------------------ void CBaseHelicopter::InitializeRotorSound( void ) { CSoundEnvelopeController &controller = CSoundEnvelopeController::GetController(); if ( m_pRotorSound ) { // Get the rotor sound started up. controller.Play( m_pRotorSound, 0.0, 100 ); controller.SoundChangeVolume(m_pRotorSound, GetRotorVolume(), 2.0); } if ( m_pRotorBlast ) { // Start the blast sound and then immediately drop it to 0 (starting it at 0 wouldn't start it) controller.Play( m_pRotorBlast, 1.0, 100 ); controller.SoundChangeVolume(m_pRotorBlast, 0, 0.0); } m_iSoundState = SND_CHANGE_PITCH; // hack for going through level transitions }