Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MIDI support and Compiler Settings command line options #164

Merged
merged 10 commits into from
Sep 9, 2022

Conversation

mkilgore
Copy link
Contributor

@mkilgore mkilgore commented Sep 5, 2022

This adds MIDI support to the language as a new unstable feature. There
are two new metacommands that come with this:

$Unstable: Midi
$MidiSoundFont: [Default|"filename"]

Once midi support is setup with those commands, you can _SNDOPEN() a MIDI
file and play it like any other sound file

The $Unstable command is required to be able to use any of the other
MIDI commands, and just signifies that this is not a full part of the
language yet and may change in breaking ways before the API is
finalized.

The $MidiSoundFont command enables MIDI support in the compiled program,
and also specifies what sound font to use to play MIDI files. Default
will make use of the soundfont placed at
'./internal/support/default_soundfont.sf2', and otherwise a filename can
be specified to use any soundfont wanted. In both cases, the selected sound
font is compiled into the executable and then loaded at runtime.

Note that MIDI is not supported when using the OpenAL backend, and we report an
error in that situation.

Command line parameters for setting things in the Compiler Settings dialog
were also added. This is actually a feature requested by a few different people
so it's nice that I finally got around to doing it, I needed it for some of the
automated testing for the MIDI stuff.

I would also like to callout some improvements I made to the testing system. I
added documentation in docs/testing.md regarding it, along with more complete
information on how to actually add new tests.

This adds support for tests of the error output of QB64-PE. The tests
are in the form of a `.bas` file that does not compile, and a `.err`
file containing the expected output of QB64-PE when producing an error
for that file.

Additionally the `compile_tests` now support multiple tests in a single
folder, via using multiple `.bas` files with different names.
This adds MIDI support to the language as a new unstable feature. There
are two new metacommands that come with this:

$Unstable: Midi
$MidiSoundFont: [Default|"filename"]

The $Unstable command is required to be able to use any of the other
commands, and just signifies that this is not a full part of the
language yet and may change in breaking ways before the API is
finalized.

The $MidiSoundFont command enables MIDI support in the compiled program,
and also specifies what sound font to use to play MIDI files. "Default"
will make use of the soundfont placed at
'./internal/support/default_soundfont.sf2', and otherwise a filename can
be specified to use any soundfont wanted.

In either case, the selected sound font is compiled into the executable
and then loaded at runtime.

Fixes: QB64-Phoenix-Edition#115
This adds a fake sound card to the GitHub build agents. The existance of
a fake sound card allows us to run tests using the audio backend on the
build agents without getting errors.
We were missing some quotes in the command line strings, so if there
were spaces involved `chmod +x` would not work correctly.
This adds compiler settings for each of the settings in the
'Compiler Settings' IDE dialog. This makes it easy to supply the
settings per compile without needing to use the IDE to change them (or
edit the `config.ini`).

Fixes: QB64-Phoenix-Edition#162
Copy link
Contributor

@a740g a740g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good. However, we'll need to decide if we are ok making changes to external libraries directly as this will become an extra step when swapping out these libraries with newer versions in the future.

internal/c/parts/audio/miniaudio.h Outdated Show resolved Hide resolved
Changing midiaudio.h will make it harder to incorporate new versions
into QB64-PE as they come out. To fix that I have reverted all the
changes to midiaudio.h and moved the few private parts we were using
into a separate 'filepath' API that's part of libqb.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
3 participants