Author Topic: Load multiple soundfont in bassmidi  (Read 3233 times)

Gamo

  • Posts: 97
Load multiple soundfont in bassmidi
« on: 30 Jun '09 - 14:09 »
Hi guy,
Let's say I have 3 style of soundfont (The sound is difference).
While I play the MIDI file I need to change the soundfont without loading the soundfont file again.
Is it possible? In the help file of bassmidi I saw

BOOL BASS_MIDI_StreamSetFonts(
    HSTREAM handle,
    BASS_MIDI_FONT *fonts,
    DWORD count
);

This function but I am not understand how to use it (count parameter)

Thank you in advance.

Ian @ un4seen

  • Administrator
  • Posts: 22250
Re: Load multiple soundfont in bassmidi
« Reply #1 on: 30 Jun '09 - 16:55 »
The "count" parameter tells BASSMIDI how many entries there are in the "fonts" array. The MIDITEST example uses the BASS_MIDI_StreamSetFonts function, so you could take a look at that for a little demonstration.

Gamo

  • Posts: 97
Re: Load multiple soundfont in bassmidi
« Reply #2 on: 1 Jul '09 - 03:25 »
Is that mean?

Fonts(0) = BASS_MIDI_FontInit("SF1.sf",0)
Fonts(1) = BASS_MIDI_FontInit("SF1.sf",0)
Fonts(2) = BASS_MIDI_FontInit("SF1.sf",0)
.. Load MIDI ..
Call BASS_MIDI_StreamSetFonts(stream,Fonts,1) ' Use First SF
..
 Play MIDI
..
Call BASS_MIDI_StreamSetFonts(stream,Fonts,2) ' Use Second SF

I didn't try it yet.


Ian @ un4seen

  • Administrator
  • Posts: 22250
Re: Load multiple soundfont in bassmidi
« Reply #3 on: 1 Jul '09 - 15:01 »
No, that's not quite right. The BASS_MIDI_StreamSetFonts function takes an array of BASS_MIDI_FONT structures, rather than HSOUNDFONT handles. Please see the BASS_MIDI_StreamSetFonts documentation for an example of how to set the BASS_MIDI_FONT members.

Gamo

  • Posts: 97
Re: Load multiple soundfont in bassmidi
« Reply #4 on: 1 Jul '09 - 15:49 »
I see. One question please.

BASS_MIDI_FONT fonts[3];
fonts[0].font=font1;
fonts[0].preset=10; // preset 10
fonts[0].bank=0; // bank 0
fonts[1].font=font3;
fonts[1].preset=74; // preset 74
fonts[1].bank=0; // bank 0
fonts[2].font=font2;
fonts[2].preset=-1; // all presets
fonts[2].bank=0; // default bank(s)
BASS_MIDI_StreamSetFonts(handle, fonts, 3); // apply it to the stream

The above means that it will use
- preset 10 from font1
- preset 74 from font3
- and the other from font2

Correct?


Ian @ un4seen

  • Administrator
  • Posts: 22250
Re: Load multiple soundfont in bassmidi
« Reply #5 on: 1 Jul '09 - 15:54 »
Yep, that looks correct.