After the source code is unzipped, open the ./libNotes directory in a terminal. g++ needs to be installed on you machine. Then create a working RAM disk with:
sudo sh ram_disk.sh
This isn't necessary, but you will have to adjust the makefile and the Gambas code to do it differently. Since I tend to recompile a lot, a RAM disk is faster and saves reads and writes on my SSD.
Assuming you have, then:
make
The Gambas code should now be able to find the library and run just fine. The code structure looks like this:
Gambas: Sound Board
|
V
Shared lib: libNotes .cpp
|
V
Support code: NotesClasses .cpp, .hpp
This is the core of the API will likely stay the same with new features added. Support for many of the features has already been built or stubbed in, so you can see what is coming by looking at the code.
Feature requests are encouraged. This is very MIDI-ish, and thus its feature set is likely to be incorporated so it can be as compatible as possible.
I very much recommend this code structure if you want to make C/C++ libraries to use from Gambas programs. They can also be called from other languages like C or Python.
I am using the PulseAudio API, rather than the traditional ALSA API, for sound rendering. Apparently, in most Linux distros, including Ubuntu which I use, PulseAudio is installed and provides an emulation layer intercepting ALSA calls, making them no longer native. On machines without PulseAudio, this program won't work.
One technical detail some may wonder about. Gambas is calling the Tick event 100 times a second based on the system clock. The audio plays audio based on the sound board clock. What about clock drift?
It doesn't seem to be a problem. If it results in underruns during silence, no one would be able to tell. If it results in overruns, over time, a pause should develop between hitting a key and hearing the note. After running for more than a full day, there is no sign of this.
Of course, controlling this, meaning monitoring and either skipping or double feeding a few Ticks is in the plans. This should also be suitable library for adding sound effects to game or other programs.