ref: cb131b06f74c138e0e2de418f9cc989b03a7c987
parent: d4c74b9d3bd4316a95d5803ed7dec737da94ee8d
author: Bernhard Schelling <[email protected]>
date: Wed Sep 13 21:53:01 EDT 2023
Merge pull request #64 from ell1e/example3-with-args Expand example3.c to accept arbitrary midi and sf2 choice
--- a/examples/example3.c
+++ b/examples/example3.c
@@ -53,6 +53,11 @@
int main(int argc, char *argv[])
{
+ // This implements a small program that you can launch without
+ // parameters for a default file & soundfont, or with these arguments:
+ //
+ // ./example3-... <yourfile>.mid <yoursoundfont>.sf2
+
tml_message* TinyMidiLoader = NULL;
// Define the desired audio output format we request
@@ -73,7 +78,7 @@
//Venture (Original WIP) by Ximon
//https://musescore.com/user/2391686/scores/841451
//License: Creative Commons copyright waiver (CC0)
- TinyMidiLoader = tml_load_filename("venture.mid");
+ TinyMidiLoader = tml_load_filename((argc >= 2 ? argv[1] : "venture.mid"));
if (!TinyMidiLoader)
{
fprintf(stderr, "Could not load MIDI file\n");
@@ -84,7 +89,9 @@
g_MidiMessage = TinyMidiLoader;
// Load the SoundFont from a file
- g_TinySoundFont = tsf_load_filename("florestan-subset.sf2");
+ g_TinySoundFont = tsf_load_filename(
+ (argc >= 3 ? argv[2] : "florestan-subset.sf2")
+ );
if (!g_TinySoundFont)
{
fprintf(stderr, "Could not load SoundFont\n");