Author Topic: Sample code for Xojo ?  (Read 129 times)

titobal

  • Posts: 1
Sample code for Xojo ?
« on: 22 Nov '17 - 08:42 »
Hello,

I'll soon migrate from old VB6 to Xojo.

Wonder if it is possible to interface BASS / BassMidi with Xojo.

My goal is to play midifiles with Soundfonts on Mac and Windows.

Anybody could provide some code ?

Many thanks in advance.

Chris.

Ian @ un4seen

  • Administrator
  • Posts: 20433
Re: Sample code for Xojo ?
« Reply #1 on: 22 Nov '17 - 13:58 »
I'm not familiar with Xojo, but if it is similar to VB6 then perhaps you can copy parts (eg. functions/options that you want to use) from the existing BASS.BAS and BASSMIDI.BAS files and modify them for it? You could start with just the functions used here:

Code: [Select]
BASS_Init(-1, 48000, 0, 0, 0); // initialize default output device
BASS_SetConfigPtr(BASS_CONFIG_MIDI_DEFFONT, sf2file); // set the soundfont to use
midistream = BASS_MIDI_StreamCreateFile(FALSE, midifile, 0, 0, 0, -1); // load a MIDI file
BASS_ChannelPlay(midistream, 0); // start playing it

...

BASS_Free(); // free the output device

Please see the documentation for details on those functions.