25 May '13 - 03:54 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: I try to use ASIO with bassmidi the sound is too fast.  (Read 827 times)
Gamo
Posts: 86


« on: 29 Jan '10 - 12:31 »
Reply with quoteQuote

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.
Logged
Ian @ un4seen
Administrator
Posts: 15276


« Reply #1 on: 29 Jan '10 - 15:52 »
Reply with quoteQuote

I notice that you are using the BASS_SAMPLE_FLOAT flag in the BASS_StreamCreateFile and BASS_MusicLoad calls, but not in the BASS_MIDI_StreamCreateFile call. Is that just a typo?
Logged
Gamo
Posts: 86


« Reply #2 on: 29 Jan '10 - 16:25 »
Reply with quoteQuote

I notice that you are using the BASS_SAMPLE_FLOAT flag in the BASS_StreamCreateFile and BASS_MusicLoad calls, but not in the BASS_MIDI_StreamCreateFile call. Is that just a typo?

Oh yes.

Thank you
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines