勇芳软件 发表于 2018-3-8 14:50:50

【VFB】播放MID、WAV文件

MIDI

初始化

Function winmmInitMidi As Integer

    Function = mciSendString( "open sequencer", Null, 0, 0 ) = 0

End Function

播放文件

Function winmmPlayMidi( ByVal filename As String ) As Integer
   
    If( mciSendString( "open " + filename + " alias mymidifile", Null, 0, 0 ) <> 0 ) Then
      Return 0
    End If
   
    Function = mciSendString( "play mymidifile", Null, 0, 0 ) = 0
   
End Function

停止播放

Function winmmStopMidi( ) As Integer
   
    mciSendString( "stop mymidifile", Null, 0, 0 )

    Function = mciSendString( "close mymidifile", Null, 0, 0 ) = 0
   
End Function

释放

Function winmmEndMidi As Integer
   
    Function = mciSendString( "close sequencer", Null, 0, 0 ) = 0
   
End Function


WAV

Function winmmPlayWave( ByVal filename As String ) As Integer

    Function = sndPlaySound( filename, SND_ASYNC )
   
End Function



0xAA55 发表于 2018-3-8 17:52:48

然而还是mci那套,论播放MIDI时你能指定合成器么?

勇芳软件 发表于 2018-3-8 22:52:23

0xAA55 发表于 2018-3-8 17:52
然而还是mci那套,论播放MIDI时你能指定合成器么?

用 MCI 命令

xiawan 发表于 2022-5-17 09:52:30


楼主大能,感谢感谢
页: [1]
查看完整版本: 【VFB】播放MID、WAV文件