Jump to content
  • Advertisement
Sign in to follow this  
hweemiin

IDirectMusicSegment8::Download failed?

This topic is 4069 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

Hi, I'm working on an application which allow users to select different games to play depending on their credits. Following is what I did: 1. Create IDirectMusicLoader8. 2. Create IDirectMusicPerformance8. 3. Create IDirectMusicAudioPath8 from performance. 4. Read data from wave file. 5. Get IDirectMusicSegment8 object from loader. 6. Calls IDirectMusicSegment8::Download to performance. 7. Repeats step 4 to 6 with 3 other files. 8. Randomly play loaded segments. 9. Stop all playing. 10. Calls IDirectMusicLoader8::ReleaseObjectByUnknown for segment. 11. Calls IDirectMusicSegment8::Unload for performance. 12. Release segment. 13. Repeats step 10 to 12 for all loaded segments. 14. Read data from the first wave file again. 15. Get IDirectMsuicSegment8 object from loader. 16. Calls IDirectMusicSegment8::Download but E_FAIL was returned. Anyone know why?

Share this post


Link to post
Share on other sites
Advertisement
try use the interface IDirectMusicLoader8* for loading

example:

IDirectMusicLoader8* DSloader = NULL;

IDirectMusicSegment8* DSsegment = NULL;

//function for load file wav
bool loadFile(char* file)
{

WCHAR sound[MAX_PATH];

//convert char for WCHAR
MultiByteToWideChar(CP_ACP, 0, file, -1, sound, MAX_PATH);

//load the file
if(FAILED(DSloader->LoadObjectFromFile(CLSID_DirectMusicSegment,
IID_IDirectMusicSegment8, sound, (void**)&DSsegment )))
return false;

//convert the segment for type WAV
DSsegment->Download( DSperformance );

return true;
}

Share this post


Link to post
Share on other sites
Thanks guys, I have figured out where the problem is.

It seem like I shouldn't use a global IDirectMusicLoader8 to load all wave files, cause in the DirectX manual I found a line stating that wave data should not be released before IDirectMusicLoader8 object. So now I use a local IDirectMusicLoader8 every time I want to load a wave file, and the problem gone.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!