I make change from DSPTest (VB demo) by add following code
On load I add this code.
' get default font (ct4mgm.sf2/ct2mgm.sf2 if available)
Dim sf As BASS_MIDI_FONT
If (BASS_MIDI_StreamGetFonts(0, sf, 1)) Then font_ = sf.font
Dim newfont As Long
newfont = BASS_MIDI_FontInit("d:\test.sf2", 0)
If (newfont And newfont <> font_) Then
Dim sf As BASS_MIDI_FONT
sf.font = newfont
sf.preset = -1 ' use all presets
sf.bank = 0 ' use default bank(s)
Call BASS_MIDI_StreamSetFonts(0, sf, 1) ' set default soundfont
Call BASS_MIDI_StreamSetFonts(chan, sf, 1) ' set for current stream too
Call BASS_MIDI_FontFree(font_) ' free old soundfont
font_ = newfont
End If
chan = BASS_StreamCreateFile(BASSFALSE, StrPtr(cmd.filename), 0, 0, BASS_SAMPLE_LOOP Or BASS_SAMPLE_FLOAT Or BASS_STREAM_DECODE)
If (chan = 0) Then chan = BASS_MusicLoad(BASSFALSE, cmd.filename, 0, 0, BASS_MUSIC_LOOP Or BASS_MUSIC_RAMPS Or BASS_SAMPLE_FLOAT Or BASS_MUSIC_DECODE, 0)
[color=red] If (chan = 0) Then chan = BASS_MIDI_StreamCreateFile(BASSFALSE, StrPtr(cmd.filename), 0, 0, BASS_SAMPLE_LOOP Or BASS_STREAM_DECODE Or BASS_MIDI_NOFX, 0)[/color]
'whatever it is, it ain't playable
If (chan = 0) Then
cmdOpen.Caption = "click here to open a file..."
Call Error_("Can't play the file")
Exit Sub
End If
For MP3 is work fine except for MIDI file sound is too fast.