Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Unliterate

trouble with direct sound CreateSoundBuffer

This topic is 5285 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I stepped through this code:
	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]

Share this post


Link to post
Share on other sites
Advertisement
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
);

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!