Beispiel #1
0
//-----------------------------------------------------------------------------
// Purpose: Ramp pitch and volume up to maximum values, based on the difference
//			between how fast we're going vs how fast we can go.
//-----------------------------------------------------------------------------
void CFuncRotating::RampPitchVol( void )
{
    //
    // Calc volume and pitch as % of maximum vol and pitch.
    //
    float fpct = fabs(m_flSpeed) / m_flMaxSpeed;
    float fvol = clamp(m_flVolume * fpct, 0.f, 1.f);			  // slowdown volume ramps down to 0

    float fpitch = FANPITCHMIN + (FANPITCHMAX - FANPITCHMIN) * fpct;

    int pitch = clamp(FastFloatToSmallInt(fpitch), 0, 255);
    if (pitch == PITCH_NORM)
    {
        pitch = PITCH_NORM - 1;
    }

    //
    // Update the fan's volume and pitch.
    //
    CPASAttenuationFilter filter( GetAbsOrigin(), m_flAttenuation );
    filter.MakeReliable();

    EmitSound_t ep;
    ep.m_nChannel = CHAN_STATIC;
    ep.m_pSoundName = STRING(m_NoiseRunning);
    ep.m_flVolume = fvol;
    ep.m_SoundLevel = ATTN_TO_SNDLVL( m_flAttenuation );
    ep.m_nFlags = SND_CHANGE_PITCH | SND_CHANGE_VOL;
    ep.m_nPitch = pitch;

    EmitSound( filter, entindex(), ep );
}
Beispiel #2
0
//-----------------------------------------------------------------------------
// Purpose: Input handler for changing pitch.
// Input  : Float new pitch from 0 - 255 (100 = as recorded).
//-----------------------------------------------------------------------------
void CAmbientGeneric::InputPitch( inputdata_t &inputdata )
{
	m_dpv.pitch = clamp( FastFloatToSmallInt( inputdata.value.Float() ), 0, 255 );

	SendSound( SND_CHANGE_PITCH );
}
Beispiel #3
0
void CBeam::InputColorBlueValue(inputdata_t &inputdata)
{
    int nNewColor = clamp(FastFloatToSmallInt(inputdata.value.Float()), 0, 255);
    SetColor(m_clrRender->r, m_clrRender->g, nNewColor);
}