Ejemplo n.º 1
0
//--------------------------------------------------------------------
//Function: Initialize
//Parameters: lpDSB - DirectSoundBuffer
//            bLoadDefaultParamValues - Load default parameters or not
//Description: Associates a DirectSoundBuffer with the manager
//             Any effects enabled in the old DirectSoundBuffer will 
//             Be disabled and the effect objects released
//--------------------------------------------------------------------
HRESULT CSoundFXManager::Initialize(LPDIRECTSOUNDBUFFER lpDSB, BOOL bLoadDefaultParamValues)
{
    HRESULT hr;

    if(m_lpDSB8)
    {
        // Release the effect for the previously associated sound buffers
        DisableAllFX();
        SAFE_RELEASE(m_lpDSB8);
    }

    if(NULL == lpDSB)
	{
        return S_OK;
	}

    // Get the interface
    if(FAILED(hr = lpDSB->QueryInterface(IID_IDirectSoundBuffer8, (LPVOID*) &m_lpDSB8)))
	{
        return hr;
	}

    if(bLoadDefaultParamValues)
	{
        LoadDefaultParamValues();
	}

    return S_OK;
}
Ejemplo n.º 2
0
//--------------------------------------------------------------------
//Function: LoadDefaultParamValues
//Parameters: Null
//Description: Loads the default param value for each effect
//--------------------------------------------------------------------
HRESULT CSoundFXManager::LoadDefaultParamValues()
{
    DWORD i;

    if(NULL == m_lpDSB8)
	{
        return E_FAIL;
	}

    for(i = eSFX_chorus; i < eNUM_SFX; i++)
	{
        SetFXEnable(i);
	}

    ActivateFX();

    if(m_lpChorus)
	{
        m_lpChorus->GetAllParameters(&m_paramsChorus);
	}

    if(m_lpCompressor)
	{
        m_lpCompressor->GetAllParameters(&m_paramsCompressor);
	}

    if(m_lpDistortion)
	{
        m_lpDistortion->GetAllParameters(&m_paramsDistortion);
	}

    if(m_lpEcho)
	{
        m_lpEcho->GetAllParameters(&m_paramsEcho);
	}

    if(m_lpFlanger)
	{
        m_lpFlanger->GetAllParameters(&m_paramsFlanger);
	}

    if(m_lpGargle)
	{
        m_lpGargle->GetAllParameters(&m_paramsGargle);
	}

    if(m_lpParamEq)
	{
        m_lpParamEq->GetAllParameters(&m_paramsParamEq);
	}

    if(m_lpReverb)
	{
        m_lpReverb->GetAllParameters(&m_paramsReverb);
	}

    DisableAllFX();

    return S_OK;
}
Ejemplo n.º 3
0
//--------------------------------------------------------------------
//Function: ~CSoundFXManager()
//Parameters: Null
//Description: Destroy the class
//--------------------------------------------------------------------
CSoundFXManager::~CSoundFXManager()
{
	// Free any effects
    DisableAllFX();

    // Release the DirectSoundBuffer
    SAFE_RELEASE(m_lpDSB8);
}
LTBOOL CPVFXMgr::Init(HOBJECT hModelObj, WEAPON* pWeapon)
{
    if (!pWeapon || !hModelObj) return LTFALSE;

	m_hModelObject = hModelObj;

	// Disable all current fx...

	DisableAllFX();

	// Set up our fx...

	HMODELSOCKET hSocket = INVALID_MODEL_SOCKET;
	for (int i=0; i < pWeapon->nNumPVFXTypes; i++)
	{
		PVFX* pFX = g_pFXButeMgr->GetPVFX(pWeapon->aPVFXTypes[i]);
		if (pFX)
		{
			// Add the sounds...

            int j;
            for (j=0; j < pFX->nNumSoundFX; j++)
			{
				AddSoundFX(g_pFXButeMgr->GetSoundFX(pFX->aSoundFXTypes[j]),
					pFX->szName);
			}

			if (pFX->szSocket[0])
			{
				if (g_pModelLT->GetSocket(m_hModelObject, pFX->szSocket, hSocket) != LT_OK)
				{
					g_pLTClient->CPrint("ERROR: CPVFXMgr::Init() %s is an Invalid socket!", pFX->szSocket);
					continue;
				}

				// Add the scale types...

				for (j=0; j < pFX->nNumScaleFXTypes; j++)
				{
					AddScaleFX(g_pFXButeMgr->GetScaleFX(pFX->aScaleFXTypes[j]),
						hSocket, pFX->szName);
				}

				// Add the dynamic lights...

				for (j=0; j < pFX->nNumDLightFX; j++)
				{
					AddDLightFX(g_pFXButeMgr->GetDLightFX(pFX->aDLightFXTypes[j]),
						hSocket, pFX->szName);
				}
			}
		}
	}


    return LTTRUE;
}