🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

DirectSound Cooperation Level Error

Started by
5 comments, last by kieren_j 24 years, 5 months ago
Hi, I''m adding a DirectSound wrapper class to my app, and I''ve written this code (keep in mind I''m using the DX5 SDK):

void SoundLibrary::Init(HWND hWnd)
{
	// (lpDirectSound is LPDIRECTSOUND type)
	//
	// this returns DS_OK:
	DirectSoundCreate(NULL, &lpDirectSound, NULL);

	// but this returns DSERR_INVALIDPARAM:
	lpDirectSound->SetCooperativeLevel(hWnd, DDSCL_NORMAL);

 
Because of this, all calls such as Play() etc. to buffers produces DSERR_PRIOLEVELNEEDED - so why does SetCooperativeLevel() fail? The hWnd parameter is valid, what else could be wrong? Thanks
Advertisement
Oh, and while I''m here....do you think it''s faster to Blt() a fullscreen 800x600x16 buffer to another, or lock it and then memcpy() each line?
Have you checked to see if your hwnd is valid?

-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
and I quote from my above code:

"The hwnd parameter is valid, what else could be wrong?"
Okay, sorry, I guess I need to be a teensy bit more specific...
Are you sure that your "valid" hWnd handle is the handle to the hWnd that you are expecting? Have you compared the memory address of that hWnd with the hWnd you created to run the game in? Valid handle does not necessarily mean valid window to do a create with.

-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
yeah, I checked it out...in the same Init() function, I tested the validity with getdc() and textout() - it worked, so I guess it''s valid...
I found out what''s wrong!
Look carefully at the flag - it says DD instead of DS!


cyas

This topic is closed to new replies.

Advertisement