#### Archived

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

# more DAudio problems

## Recommended Posts

Laroche    140
I got rid of all the other problems by re-typing everything in (weird?) but now when i try to load a midi, i get an unhandled exception return code 0x000005 or something. Anyway the problem is in this line:
m_pSegment->SetParam(GUID_StandardMIDIFile, 0xFFFFFFFF,0,0,NULL);

Is it normal to have this failed? Am i forgetting to do something silly? let me post the loading code..

// In my program in WINMAIN I have a pointer to a CMidiMusic

// object called "pDirectDraw"...

// Now here is the function

{
WCHAR wstrMidi[256];

// If exists a segment before, then release it

if (m_pSegment)
SAFE_RELEASE(m_pSegment);

// Converts ANSI (8-bits) to the UNICODE (16-bit) string

MultiByteToWideChar(CP_ACP,0,szMidi,-1,wstrMidi,256);

// Then load it into the segment

IID_IDirectMusicSegment8,wstrMidi,
(LPVOID*) &m_pSegment);

// In case it is a midi file mark it is a standard midi file

if (bMidiFile)
{
m_pSegment->SetParam(GUID_StandardMIDIFile, 0xFFFFFFFF,0,0,NULL);
}

return (TRUE);
}

sorry it is long but I''m stuck, and it wont let me put directmusic in debug mode for some reason..

##### Share on other sites
If i remember right direct music will crash if you try to play a segment that couldn''t be loaded. You need to check for this... or get the filename right (path too).