if(SoundFormat==NULL)
{
user_specified_format=false;
SoundFormat=new WAVEFORMATEX;
ZeroMemory(SoundFormat,sizeof(SoundFormat));
SoundFormat->wFormatTag=(WORD)WAVE_FORMAT_PCM;
SoundFormat->nChannels=2;
SoundFormat->nSamplesPerSec=44100;
SoundFormat->wBitsPerSample=16;
SoundFormat->nBlockAlign=(WORD)SoundFormat->nChannels*SoundFormat->wBitsPerSample/8;
SoundFormat->nAvgBytesPerSec=(DWORD)SoundFormat->nSamplesPerSec*SoundFormat->nBlockAlign;
}
DSBUFFERDESC BufferDescrition;
ZeroMemory(&BufferDescrition,sizeof(BufferDescrition));
BufferDescrition.dwSize=sizeof(BufferDescrition);
BufferDescrition.dwFlags=DSBCAPS_CTRLPAN|DSBCAPS_CTRLVOLUME|DSBCAPS_STATIC;
BufferDescrition.dwReserved=0;
BufferDescrition.guid3DAlgorithm=DS3DALG_NO_VIRTUALIZATION;
BufferDescrition.lpwfxFormat=SoundFormat;
tester=Interface->CreateSoundBuffer(
&BufferDescrition,
&SecondaryBuffers[index],
NULL
);
and i copied the hex value of tester into the DirectX Error Lookup program and its telling me:
HRESULT: 0x80070057 (2147942487)
Name: E_INVALIDARG
Description: An invalid parameter was passed to the returning function
Severity code: Failed
Facility Code: FACILITY_WIN32 (7)
Error Code: 0x0057 (87)
can anyone see an invalid paramter?, does the pointer to the buffer i send have to be NULL? (0x00000000).
[edited by - unliterate on June 2, 2004 7:02:47 PM]
[edited by - unliterate on June 2, 2004 7:03:36 PM]
trouble with direct sound CreateSoundBuffer
I stepped through this code:
i tried this to make sure there wasnt something wrong with my buffer pointer, and i still get the same error.
LPDIRECTSOUNDBUFFER temporary=NULL; tester=Interface->CreateSoundBuffer( &BufferDescrition, &temporary,//SecondaryBuffers[index], NULL );
ok, i basically threw out most of the structure setup and used the CWaveFile class, i hadnt relised i could do this (the book im reading has totally diferent text, from actual code in its examples on a cd.)
[edited by - unliterate on June 2, 2004 8:48:56 PM]
[edited by - unliterate on June 2, 2004 8:48:56 PM]
yeah ended up wrapping up the listener, sound device, buffer, buffer3d classes and used the cwavefile
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement