Code: Select all
#include <atlcomcli.h>
#include <Pdk.h>
#include <InitGuid.h>
#include <ISoundService.h>
...
P3D::IPdk* pIPdk = nullptr;
CComPtr<P3D::ISoundServiceV440> pPdkSoundService;
CComPtr<P3D::ISoundInstanceV440> pPdkGearWarningSoundInstance;
LPCWSTR pszFileName = L"sound.wav";
Code: Select all
query_pdk(P3D::IID_IPdk, (void **)&pIPdk);
pIPdk->QueryService(P3D::SID_SoundService, P3D::IID_ISoundInstanceV440, (void**)&pPdkSoundService);
pPdkSoundService->CreateSoundInstance(pszFileName, P3D::SOUND_GROUP::SOUND_GROUP_COCKPIT, P3D::VIEW_POINT::VIEW_POINT_INTERIOR, TRUE, FALSE, FALSE, (void **)&pPdkGearWarningSoundInstance);
Code: Select all
pPdkGearWarningSoundInstance->Play();