Skip to content

Commit

Permalink
add -midi-in option back as a toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
mooinglemur committed Oct 3, 2024
1 parent 6949905 commit 3f8303b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,10 @@ usage()
printf("-sf2 <SoundFont filename>\n");
printf("\tInitialize MIDI synth with the specified SoundFont.\n");
printf("\tThe -midicard option must be specified along with this option.\n");
printf("-midi-in\n");
printf("\tConnect the system MIDI input devices to the input of the first UART.\n");
printf("\tof the emulated MIDI card. The -midicard option is required for this\n");
printf("\toption to have any effect.\n");
#ifdef TRACE
printf("-trace [<address>]\n");
printf("\tPrint instruction trace. Optionally, a trigger address\n");
Expand Down Expand Up @@ -663,6 +667,10 @@ main(int argc, char **argv)
sf2_path = argv[0];
argc--;
argv++;
} else if (!strcmp(argv[0], "-midi-in")) {
argc--;
argv++;
fs_midi_autoconnect = true;
} else if (!strcmp(argv[0], "-run")) {
argc--;
argv++;
Expand Down
3 changes: 2 additions & 1 deletion src/midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ struct midi_serial_regs mregs[2];
static bool serial_midi_mutexes_initialized = false;

void midi_serial_iir_check(uint8_t sel);
bool fs_midi_autoconnect = false;

#ifndef __EMSCRIPTEN__

Expand Down Expand Up @@ -268,7 +269,7 @@ void midi_init()
dl_fluid_settings_setnum(fl_settings, "synth.sample-rate",
AUDIO_SAMPLERATE);
dl_fluid_settings_setstr(fl_settings, "midi.portname", "Commander X16 Emulator");
dl_fluid_settings_setint(fl_settings, "midi.autoconnect", 1);
dl_fluid_settings_setint(fl_settings, "midi.autoconnect", fs_midi_autoconnect);
fl_synth = dl_new_fluid_synth(fl_settings);
fl_mdriver = dl_new_fluid_midi_driver(fl_settings, handle_midi_event, &mregs[0]);

Expand Down
1 change: 1 addition & 0 deletions src/midi.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ void midi_load_sf2(uint8_t* filename);
void midi_synth_render(int16_t* buf, int len);
bool midi_serial_irq(void);

extern bool fs_midi_autoconnect;

0 comments on commit 3f8303b

Please sign in to comment.