-
Hey guys,
I copied this code from MS's website to play a midi in the background:
Public gObjDX As New DirectX7
Public gObjDMLoader As DirectMusicLoader
Public gObjDMPerformance As DirectMusicPerformance
Dim objSegState As DirectMusicSegmentState
Dim objSeg As DirectMusicSegment
Set gObjDMLoader = gObjDX.DirectMusicLoaderCreate
Set gObjDMPerformance = gObjDX.DirectMusicPerformanceCreate
Call gObjDMPerformance.Init(Nothing, hWnd)
Call gObjDMPerformance.SetPort(-1, 1)
strMIDI = CurDir & "\Directory\music.mid"
Set objSeg = gObjDMLoader.LoadSegment(strMIDI)
Call gObjDMPerformance.SetMasterAutoDownload(True)
Call objSeg.Download(gObjDMPerformance)
Call gObjDMPerformance.PlaySegment(objSeg, 0, 0)
'Set objSegState = gObjDMPerformance.PlaySegment(gObjPrimarySeg, 0, 0)
SO what is the command to stop the music? Does anybody know this one?
-
indeed:
DirectMusicPerformance.Stop
parameters:
segment - the segment to stop
segmentstate - the segment state of the above segment (you dont need this)
time - when to stop, set to 0 for immediately
flags - set to 0 probably (the other values are a bit obscure, you wont need them).
-
Segment
Sorry Kenny, but one last question.....
which is the segment to stop:
objSeg
strMIDI
?
I haven't gottten either one to work..
-
the segment object!
eg
Call DmPer.Stop(segment, nothing, 0, 0)
that should work.
-
got it, thanks
Right.
I got that this afternoon.
I guess I should have spent more time trying to figure it out myself before posting
The part I was missing was the 2nd one (nothing). So my game is pretty much complete.
Thanks again.