Jump to content
  • Advertisement

Archived

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

Gyannea

Why does this second call fail?

This topic is 5296 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 have a section of code that initializes a direct sound capture object then buffer and then a notify object for that buffer: --------------------------- [All of this works] if(FAILED(pdsRXOb->CreateCaptureBuffer(&dsRXbd, &pdsRXBufOb, NULL))) // Create the capture buffer { return FALSE; } dsRXBufCaps.dwSize = sizeof(DSCBCAPS); // Get the capture buffer capabilities if(FAILED(pdsRXBufOb->GetCaps(&dsRXBufCaps))) { return FALSE; } // Create Notification interface for the capture buffer if(FAILED(pdsRXBufOb->QueryInterface(IID_IDirectSoundNotify, (void **)&pdsRXNotifyOb))) { return(FALSE); } ---------------------------------------------- It works fine. At least it compiles and executes. However, then I initialize a direct sound object, a secondary buffer and then try to place a notify object on that buffer. The notification object fails when executed. ---------------------------------------------- // Create the DirectSound buffer [This works] if(FAILED(pdsTXOb->CreateSoundBuffer(&dsTXbd, &pdsTXSecBufOb, NULL))) { return(FALSE); } // Create Notification interface for the send buffer [FAILS!!] if(FAILED(pdsTXSecBufOb->QueryInterface(IID_IDirectSoundNotify, (void **)&pdsTXNotifyOb))) { return(FALSE); } ----------------------------------------- Any ideas why I can''t create a notify object on the send buffer? Brian Reinhold

Share this post


Link to post
Share on other sites
Advertisement
The error return value is "E_NOINTERFACE" but that seems hard to believe given that the capture buffer works, the computer (1 year old Gateway) and soundcard (Soundblaster Live) are modern.

I tried using the outdated initialization method on the buffer but that gives "already initialized" so that obviously is not a solution.

It''s hard to know where to go from here!

I wanted to put the receive and send activities in a single high priority thread using a WaitForMulipleEvents() function to handle the two actions.

Does it make any sense that the interface would be available for the capture but not the play option? If anything, I would assume the reverse!

Not first creating the capture notify object doesn''t change things either!



Brian Reinhold

Share this post


Link to post
Share on other sites
Dave, it didn''t work. Same error...no interface. How could that be? I thought the primary purpose of having the notify event thing was for streaming playback. I don''t even know where to turn.


Brian Reinhold

Share this post


Link to post
Share on other sites
According to MSDN, the CreateSoundBuffer method returns an IDirectSoundBuffer interface. You have to QueryInterface to get an IDirectSoundBuffer8 interface. Once you have a pointer to IDirectSoundBuffer8, you should be able to get your notify pointer via IID_IDirectSoundNotify8. I''m just guessing since I''m at work and can''t reference my own code, so this may not help.

Share this post


Link to post
Share on other sites
That step of querying the DirectSoundBuffer interface to get the DirectSoundBuffer8 interface I have not done.

I have just created the Direct Sound object,
and from that created a DirectSoundBuffer object.

Wonder what the GUID idnetifier is called?

Brian

Share this post


Link to post
Share on other sites
I still get the same error, even though I can query the directsoundbuffer interface to get the ''8'' version. But I can''t query the ''8'' version to get the notify object.

I used DirectSoundCreate8 on the ''8'' version of the direct sound object. Maybe I should keep it at no ''8''?

This is crazy. I wish I could see an example, but the SDK doesn''t have one for directsound...just directsoundcapture. At least that which I can find!

Brian

Share this post


Link to post
Share on other sites
You definitely want the ''8'' version of the Create function.

I''ll see if I can find my notification code when I get home (unless someone else here has any suggestions).

Share this post


Link to post
Share on other sites
Dave,

If I add the flag "DSBCAPS_CTRLPOSITIONNOTIFY" in the DSBCAPS structure in my above code when creating the DirectSound object, then the notify interface is able to be created as written above, without all the ''8'' options. Why I need to do this for the DirectSound object and NOT the DirectSoundCapture object is something which I don''t understand.

Whether the notify event action will work, on the other hand, I have not tried. Now at least I will be able to proceed.

It is quite frustrating and it cost me a whole day! Thanks for your help. I DO wish there was more information somewhere on DirectSound and subsets. There is certainly PLENTY on DirectX in the graphics part!

Brian Reinhold

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!