Archived

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

Laroche

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"...

pDirectMusic->LoadMidiFromFile("IntroTheme.mid",TRUE);

// Now here is the function

int CMidiMusic::LoadMidiFromFile(LPCSTR szMidi,BOOL bMidiFile)
{
	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

	m_pLoader->LoadObjectFromFile(CLSID_DirectMusicSegment,   
							 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);          
	}
    
	// Finally, download band data to the performance  

	m_pSegment->Download(m_pPerformance);
	

	return (TRUE);
}
  
sorry it is long but I''m stuck, and it wont let me put directmusic in debug mode for some reason..

Share this post


Link to post
Share on other sites
PaladinGLT    122
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).

PaladinGLT

Share this post


Link to post
Share on other sites