Author Topic: BASS_MIDI_FONTEX limit? and memory usage  (Read 186 times)

Anthony Y

  • Posts: 7
BASS_MIDI_FONTEX limit? and memory usage
« on: 27 Apr '19 - 11:41 »
Hi,

I am using just one soundfont file and initialise only once (file size is about 100mb)

int soundfont0 = BASSMIDI.BASS_MIDI_FontInit(file, 0);

if I use different banks and presets for each instrument, will it use much more memory?
e.g.

BASSMIDI.BASS_MIDI_FONTEX[] fonts = new BASSMIDI.BASS_MIDI_FONTEX[100]; // or 1000 maybe

fonts[0] = new BASSMIDI.BASS_MIDI_FONTEX();
fonts[0].font = soundfont0;
fonts[0].spreset = 24;
fonts[0].sbank = 8;
fonts[0].dpreset = 128;
fonts[0].dbank = 0;
fonts[0].dbanklsb = 0;

fonts[1] = new BASSMIDI.BASS_MIDI_FONTEX();
fonts[1].font = soundfont0;
fonts[1].spreset = 123;
fonts[1].sbank = 1;
fonts[1].dpreset = 129;
fonts[1].dbank = 0;
fonts[1].dbanklsb = 0;

...

fonts[last] = new BASSMIDI.BASS_MIDI_FONTEX();
fonts[last].font = soundfont0;
fonts[last].spreset = -1;
fonts[last].sbank = -1;
fonts[last].dpreset = -1;
fonts[last].dbank = 0;
fonts[last].dbanklsb = 0;

BASSMIDI.BASS_MIDI_StreamSetFonts(stream, fonts, soundfontCounter|BASSMIDI.BASS_MIDI_FONT_EX);



+ if I use multiple soundfont files, will it occupy more memory?

Thank you.
« Last Edit: 27 Apr '19 - 12:26 by Anthony Y »

Ian @ un4seen

  • Administrator
  • Posts: 21861
Re: BASS_MIDI_FONTEX limit? and memory usage
« Reply #1 on: 29 Apr '19 - 14:33 »
Using the same soundfont in multiple BASS_MIDI_FONTEX records won't use more memory; there will still be only one copy of the soundfont in memory. If you use multiple soundfonts then each of them will naturally take up some memory, but the sample data is usually the largest part of a soundfont and that is only loaded as needed during playback (or requested via BASS_MIDI_FontLoad/BASS_MIDI_StreamLoadSamples). BASSMIDI preloads a soundfont's instrument/etc information but not its sample data.