chore(fmod): add files from Chensne/DragonNest
This commit is contained in:
commit
50fb3c6b1c
544 changed files with 315778 additions and 0 deletions
193
win32/src/fmod_channel_dsound_eax2.cpp
Executable file
193
win32/src/fmod_channel_dsound_eax2.cpp
Executable file
|
|
@ -0,0 +1,193 @@
|
|||
#include "fmod_settings.h"
|
||||
|
||||
#ifdef FMOD_SUPPORT_EAX
|
||||
|
||||
#include "fmod_output_dsound.h"
|
||||
#include "fmod_channel_dsound_eax2.h"
|
||||
#include "fmod_eax2.h"
|
||||
|
||||
|
||||
namespace FMOD
|
||||
{
|
||||
|
||||
/*
|
||||
[
|
||||
[DESCRIPTION]
|
||||
|
||||
[PARAMETERS]
|
||||
|
||||
[RETURN_VALUE]
|
||||
FMOD_OK
|
||||
|
||||
[REMARKS]
|
||||
|
||||
[PLATFORMS]
|
||||
Win32, Win64
|
||||
|
||||
[SEE_ALSO]
|
||||
]
|
||||
*/
|
||||
FMOD_RESULT ChannelDSoundEAX2::setReverbProperties(const FMOD_REVERB_CHANNELPROPERTIES *prop)
|
||||
{
|
||||
HRESULT hr;
|
||||
EAXBUFFERPROPERTIES dsprops;
|
||||
GUID guid;
|
||||
|
||||
if (!mOutputDSound)
|
||||
{
|
||||
return FMOD_ERR_UNINITIALIZED;
|
||||
}
|
||||
|
||||
if (!prop)
|
||||
{
|
||||
return FMOD_ERR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
if (!mBuffer3D)
|
||||
{
|
||||
return FMOD_ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
OBTAIN REVERB INTERFACE
|
||||
*/
|
||||
if (!mBufferReverb)
|
||||
{
|
||||
if (mFlags & CHANNELREAL_FLAG_PAUSED && mOutputDSound->mDirectXVersion >= 8)
|
||||
{
|
||||
mBuffer->AcquireResources(DSBPLAY_LOCHARDWARE, 0, NULL);
|
||||
}
|
||||
|
||||
FMOD_memcpy(&guid, &FMOD_IID_IKsPropertySet, sizeof(GUID));
|
||||
|
||||
hr = mBuffer3D->QueryInterface(guid, (void **)&mBufferReverb);
|
||||
if (hr != DS_OK)
|
||||
{
|
||||
return FMOD_ERR_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
NOW SET CHANNEL PROPERTIES
|
||||
*/
|
||||
dsprops.lDirect = prop->Direct;
|
||||
dsprops.lDirectHF = prop->DirectHF;
|
||||
dsprops.lRoom = prop->Room;
|
||||
dsprops.lRoomHF = prop->RoomHF;
|
||||
dsprops.lObstruction = prop->Obstruction;
|
||||
dsprops.flObstructionLFRatio = prop->ObstructionLFRatio;
|
||||
dsprops.lOcclusion = prop->Occlusion;
|
||||
dsprops.flOcclusionLFRatio = prop->OcclusionLFRatio;
|
||||
dsprops.flOcclusionRoomRatio = prop->OcclusionRoomRatio;
|
||||
dsprops.lOutsideVolumeHF = prop->OutsideVolumeHF;
|
||||
dsprops.flRoomRolloffFactor = prop->RoomRolloffFactor;
|
||||
dsprops.flAirAbsorptionFactor = prop->AirAbsorptionFactor;
|
||||
dsprops.dwFlags = prop->Flags;
|
||||
|
||||
FMOD_memcpy(&guid, &FMOD_DSPROPSETID_EAX20_BufferProperties, sizeof(GUID));
|
||||
|
||||
hr = mBufferReverb->Set(guid, DSPROPERTY_EAXBUFFER_ALLPARAMETERS, NULL, 0, &dsprops, sizeof(EAXBUFFERPROPERTIES));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
return FMOD_ERR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
return FMOD_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
[
|
||||
[DESCRIPTION]
|
||||
|
||||
[PARAMETERS]
|
||||
|
||||
[RETURN_VALUE]
|
||||
FMOD_OK
|
||||
|
||||
[REMARKS]
|
||||
|
||||
[PLATFORMS]
|
||||
Win32, Win64
|
||||
|
||||
[SEE_ALSO]
|
||||
]
|
||||
*/
|
||||
FMOD_RESULT ChannelDSoundEAX2::getReverbProperties(FMOD_REVERB_CHANNELPROPERTIES *prop)
|
||||
{
|
||||
HRESULT hr;
|
||||
EAXBUFFERPROPERTIES dsprops;
|
||||
GUID guid;
|
||||
ULONG ulReceived;
|
||||
|
||||
if (!mOutputDSound)
|
||||
{
|
||||
return FMOD_ERR_UNINITIALIZED;
|
||||
}
|
||||
|
||||
if (!prop)
|
||||
{
|
||||
return FMOD_ERR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
if (!mBuffer3D)
|
||||
{
|
||||
return FMOD_ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
OBTAIN REVERB INTERFACE
|
||||
*/
|
||||
if (!mBufferReverb)
|
||||
{
|
||||
if (mFlags & CHANNELREAL_FLAG_PAUSED && mOutputDSound->mDirectXVersion >= 8)
|
||||
{
|
||||
mBuffer->AcquireResources(DSBPLAY_LOCHARDWARE, 0, NULL);
|
||||
}
|
||||
|
||||
FMOD_memcpy(&guid, &FMOD_IID_IKsPropertySet, sizeof(GUID));
|
||||
|
||||
hr = mBuffer3D->QueryInterface(guid, (void **)&mBufferReverb);
|
||||
if (hr != DS_OK)
|
||||
{
|
||||
return FMOD_ERR_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Get reverb properties
|
||||
*/
|
||||
FMOD_memcpy(&guid, &FMOD_DSPROPSETID_EAX20_BufferProperties, sizeof(GUID));
|
||||
|
||||
hr = mBufferReverb->Get(guid, DSPROPERTY_EAXBUFFER_ALLPARAMETERS, NULL, 0, &dsprops, sizeof(EAXBUFFERPROPERTIES), &ulReceived);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
return FMOD_ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
prop->Direct = dsprops.lDirect;
|
||||
prop->DirectHF = dsprops.lDirectHF;
|
||||
prop->Room = dsprops.lRoom;
|
||||
prop->RoomHF = dsprops.lRoomHF;
|
||||
prop->Obstruction = dsprops.lObstruction;
|
||||
prop->ObstructionLFRatio = dsprops.flObstructionLFRatio;
|
||||
prop->Occlusion = dsprops.lOcclusion;
|
||||
prop->OcclusionLFRatio = dsprops.flOcclusionLFRatio;
|
||||
prop->OcclusionRoomRatio = dsprops.flOcclusionRoomRatio;
|
||||
prop->OcclusionDirectRatio = 0;
|
||||
prop->Exclusion = 0;
|
||||
prop->ExclusionLFRatio = 0;
|
||||
prop->OutsideVolumeHF = dsprops.lOutsideVolumeHF;
|
||||
prop->DopplerFactor = 0;
|
||||
prop->RolloffFactor = 0;
|
||||
prop->RoomRolloffFactor = dsprops.flRoomRolloffFactor;
|
||||
prop->AirAbsorptionFactor = dsprops.flAirAbsorptionFactor;
|
||||
prop->Flags = dsprops.dwFlags;
|
||||
|
||||
return FMOD_OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue