Skip to main content
gamedev.net
🔒 Locked

more DAudio problems

Started by Laroche Jun 8, 2002 at 3:28 PM 0 replies 250+ views
Original Post
Laroche
Laroche
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..
Check out my music at: http://zed.cbc.ca/go.ZeD?user_id=41947&user=Laroche&page=content
PaladinGLT
PaladinGLT
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
PaladinGLT

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.