Archived

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

DirectMusic Storing wavs in memory

This topic is 5674 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 am new to useing any part of DirectX and I needed to use DirectMusic in my demo I was making so I read the Tutorial that came with the SDK and go it working it made the demo a lot slower but it was good enought for the time but not I need to load those wavs into memory so there is very little proformace hit how do I do this? here is my code right now for opening a sound and playing it on command.
    
void PlaySound(String FileName)
{
TStringConverter<char> T;
if( FAILED( g_pLoader->LoadObjectFromFile( CLSID_DirectMusicSegment,
                                               IID_IDirectMusicSegment8,
                                                T.AnsiToWide(FileName.c_str()),
                                               (LPVOID*) &g_pSegment ) ) )
    {
    }
    g_pSegment->Download( g_pPerformance);
g_pPerformance->PlaySegmentEx( g_pSegment, NULL, NULL, DMUS_SEGF_SECONDARY | DMUS_SEGF_DEFAULT, 0, NULL, NULL,  g_p3DAudiopathUs);
}
  
if you have a link to some where I can learn to do this that would be much more sencable then doing it all here I guess.

Share this post


Link to post
Share on other sites
ummm, you dont load your wavs every time you play them. you preload them at the start. see the sdk. understand what the functions do and how things work. dont just copy and change the code. why are you not pre laoding all the segments at the start? is there any particular reason?

also next time try and proof read your question, its HORRID english and diffiuclt to make out. things like puncuation are useful. run on sentences are terrible. some of the forigen ppl here are clearer than your query. i assume you need to load the wavs into memory. which answers your own question. look at "your" code, understand the functions, realize the flow, and use the solution that stares you in the face.

Share this post


Link to post
Share on other sites
Sorry about that, I had to keep going back and rephasing things. So I create a new Segment for each sound? and then I just download it when I want to play it?

Share this post


Link to post
Share on other sites