DirectMusic automation error

GIAKEN
08-08-2007, 08:27 PM
I am getting an automation error with DirectMusic. Here's the code:

Public Sub LoadMidi(ByRef Song As String)

Set loader = DX.DirectMusicLoaderCreate()
Set perf = DX.DirectMusicPerformanceCreate()
Call perf.Init(Nothing, 0)
perf.SetPort -1, 80
Call perf.SetMasterAutoDownload(True)
perf.SetMasterVolume (75 * 42 - 3000)

Set seg = loader.LoadSegment(App.Path & "\" & Song)
seg.SetStandardMidiFile

End Sub

It is highlighting:

Set seg = loader.LoadSegment(App.Path & "\" & Song)

If anybody could help me solve this, I'd be much appreciated.

Roger_Wgnr
08-08-2007, 10:29 PM
What is the variable Song when the code fails?
It may be that App.Path\Song is not returning a valid filename and path.

GIAKEN
08-09-2007, 10:19 AM
Song is "example.midi".

Call LoadMidi("example.midi")

I'm just making a test program to see if I can get DirectSound and DirectMusic to work (which DirectSound does work).

EDIT: Alright, I got the error description of the automation error:

Error Number : 88781182 ( -2005397118 )

Error Code : DMUS_E_LOADER_FAILEDOPEN

Description : File open failed - either file doesn't exist or is locked.

It's a strange error, seeing as I have the example.midi and I am pretty sure it's not locked.

EDIT: YES! It works! I had to change from MIDI to MID. Thanks for the help, everyone.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum