Direct Sound (Grrrrr)

Started by
8 comments, last by Kudaba 23 years, 6 months ago
Well, just wondering is anyone has had any experience with the "DirectX in 24 hours" code. I used it and I am getting an error with the CreateSoundBuffer() call. I basically used the EXACT same code, is there an error there or something, maybe something I should know about dsound that they don''t tell me (which seems to happen quite often with this book). Any help will be much obliged (I think that''s the right word). Retired Pokemon Master of Prgramming Problems I already had them all.
This Space for rent.
Advertisement
That book has about 3000 errors in it. I''m unsure if they even proof-read it. Well, what is the exact problem?

------------------------------
#pragma twice


sharewaregames.20m.com

Can you paste the code which you use? Maybe I can help you
ZeroMemory(&dsBD, sizeof(DSBUFFERDESC));
dsBD.dwSize = sizeof(DSBUFFERDESC);
dsBD.dwFlags = DSBCAPS_CTRLVOLUME | DSBCAPS_STATIC;

//Set up the Sound(s)
dsBD.dwBufferBytes = dwDataLen;
dsBD.lpwfxFormat = &wfFormat

hRes = lpDS->CreateSoundBuffer(&dsBD, &lpDSBSound, NULL)
if (hRes != DS_OK)
//Check the error

The error I''m getting out of here is DSERR_CONTROLUNAVAIL. Here''s my setup code just before this:

if (DirectSoundCreate(NULL, &lpDS, NULL) != DS_OK)
error("DirectSoundCreate");

if(lpDS->SetCooperativeLevel(hWnd, DSSCL_NORMAL) != DS_OK)
error("lpDS->SetCooperativeLevel");

HRESULT hres;
CWave Sound;
CWave Music;

Sound.Create(szSound);
Music.Create(szMusic);

DWORD dwDataLen;
WAVEFORMATEX wfFormat;
DSBUFFERDESC dsBD;
BYTE* pDSBuffData;

dwDataLen = Sound.GetDataLen();
Sound.GetFormat(wfFormat);


/* That''s almost the EXACT same way they use it in the book, I thikn the only differences are the variable names. */

Retired Pokemon Master of Prgramming Problems

I already had them all.
This Space for rent.
I have that book. I didnt use his DS code though. I just read the DS theory part. My advice is to just use the SDK''s wave reader and look at the sample that loads a .wav into a static buffer.

ECKILLER
ECKILLER
Why dont u try the DXSDK sample code instead? Ive copied a few bits and pieces and it works fine.


Microsoft developed DX, so im guessing they ''know'' how to use it.

  Downloads:  ZeroOne Realm

Thanks guys, using the SDK over the book sounds good seeing how the book sucks hardcore.


Retired Pokemon Master of Prgramming Problems

I already had them all.
This Space for rent.
I just would like to say one thing: use FMOD



- - - - - - - - - - - - - -
Andreas Mähler
Wolf359 Interactive
*lol* Perhaps it''s called DirectX in 24 hours ''cause it was written and proofread in 24 hours?


People might not remember what you said, or what you did, but they will always remember how you made them feel.
~ (V)^|) |<é!t|-| ~
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.
Is FMOD pretty easy to use, and does it support MP3??
This Space for rent.

This topic is closed to new replies.

Advertisement