Dark Kiromaru
March 8th, 2009, 12:40 PM
I have a project I've been working on a while but just recently decided to add sound. So since it's for a class about directx we're using directsound. Now in all the projects from the book they compile nice and easy no problems. Now my project decided it was gonna have some interesting bugs. The code that was made was from the DirectX 9 SDK.
The error occurs when I simply use the designated functions to try and call a .wav file. On my game.cpp, I have these two pieces of code:
CSound *sound_bounce;
sound_bounce = LoadSound("bounce.wav");
if (sound_bounce == NULL)
return 0;
This matches the examples in the book. Now when I run the code (with all the #includes listed in the book and additional dependencies listed)
It gives me an error: Unhandled exception at 0x004242d4 in program.exe Access Violation at 0x000005.
And points me to the Dsutil.cpp at
HRESULT CSoundManager::Create( CSound** ppSound,
LPTSTR strWaveFileName,
DWORD dwCreationFlags,
GUID guid3DAlgorithm,
DWORD dwNumBuffers )
{
HRESULT hr;
HRESULT hrRet = S_OK;
DWORD i;
LPDIRECTSOUNDBUFFER* apDSBuffer = NULL;
DWORD dwDSBufferSize = NULL;
CWaveFile* pWaveFile = NULL;
>>>if( m_pDS == NULL )
return CO_E_NOTINITIALIZED;
if( strWaveFileName == NULL || ppSound == NULL || dwNumBuffers < 1 )
return E_INVALIDARG;
Where the >>> is...
I'm baffled and if anyone can help me to solve this today that would be amazing! I've tried to find some guides to figure out whats going on more but I'm baffled!
The error occurs when I simply use the designated functions to try and call a .wav file. On my game.cpp, I have these two pieces of code:
CSound *sound_bounce;
sound_bounce = LoadSound("bounce.wav");
if (sound_bounce == NULL)
return 0;
This matches the examples in the book. Now when I run the code (with all the #includes listed in the book and additional dependencies listed)
It gives me an error: Unhandled exception at 0x004242d4 in program.exe Access Violation at 0x000005.
And points me to the Dsutil.cpp at
HRESULT CSoundManager::Create( CSound** ppSound,
LPTSTR strWaveFileName,
DWORD dwCreationFlags,
GUID guid3DAlgorithm,
DWORD dwNumBuffers )
{
HRESULT hr;
HRESULT hrRet = S_OK;
DWORD i;
LPDIRECTSOUNDBUFFER* apDSBuffer = NULL;
DWORD dwDSBufferSize = NULL;
CWaveFile* pWaveFile = NULL;
>>>if( m_pDS == NULL )
return CO_E_NOTINITIALIZED;
if( strWaveFileName == NULL || ppSound == NULL || dwNumBuffers < 1 )
return E_INVALIDARG;
Where the >>> is...
I'm baffled and if anyone can help me to solve this today that would be amazing! I've tried to find some guides to figure out whats going on more but I'm baffled!