From 297909a8846a8d5573d4994e5fee7f1afc1f0b6d Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 13 Mar 2022 09:00:03 -0400 Subject: [PATCH] midi out device named correctly to aid code readability --- src/86box.c | 8 +- src/config.c | 9 +- src/include/86box/midi.h | 22 ++--- src/include/86box/midi_rtmidi.h | 4 +- src/qt/qt_deviceconfig.cpp | 4 +- src/qt/qt_settingssound.cpp | 16 ++-- src/sound/midi.c | 158 ++++++++++++++++---------------- src/sound/midi_fluidsynth.c | 2 +- src/sound/midi_mt32.c | 2 +- src/sound/midi_rtmidi.cpp | 29 +++--- src/sound/sound.c | 2 +- src/sound/xaudio2.c | 2 +- src/win/win_devconf.c | 4 +- src/win/win_settings.c | 28 +++--- 14 files changed, 146 insertions(+), 144 deletions(-) diff --git a/src/86box.c b/src/86box.c index 17a1cca9c..344dc8294 100644 --- a/src/86box.c +++ b/src/86box.c @@ -935,7 +935,9 @@ pc_reset_hard_close(void) scsi_device_close_all(); - midi_close(); + midi_out_close(); + + midi_in_close(); cdrom_close(); @@ -1158,7 +1160,9 @@ pc_close(thread_t *ptr) scsi_device_close_all(); - midi_close(); + midi_out_close(); + + midi_in_close(); network_close(); diff --git a/src/config.c b/src/config.c index acf70d15a..4dbbb4a21 100644 --- a/src/config.c +++ b/src/config.c @@ -1036,9 +1036,9 @@ load_sound(void) p = config_get_string(cat, "midi_device", NULL); if (p != NULL) - midi_device_current = midi_device_get_from_internal_name(p); + midi_output_device_current = midi_out_device_get_from_internal_name(p); else - midi_device_current = 0; + midi_output_device_current = 0; p = config_get_string(cat, "midi_in_device", NULL); if (p != NULL) @@ -2111,6 +2111,7 @@ config_load(void) serial_enabled[1] = 1; for (i = 2 ; i < SERIAL_MAX; i++) serial_enabled[i] = 0; + lpt_ports[0].enabled = 1; for (i = 1 ; i < PARALLEL_MAX; i++) @@ -2529,10 +2530,10 @@ save_sound(void) else config_set_string(cat, "sndcard", sound_card_get_internal_name(sound_card_current)); - if (!strcmp(midi_device_get_internal_name(midi_device_current), "none")) + if (!strcmp(midi_out_device_get_internal_name(midi_output_device_current), "none")) config_delete_var(cat, "midi_device"); else - config_set_string(cat, "midi_device", midi_device_get_internal_name(midi_device_current)); + config_set_string(cat, "midi_device", midi_out_device_get_internal_name(midi_output_device_current)); if (!strcmp(midi_in_device_get_internal_name(midi_input_device_current), "none")) config_delete_var(cat, "midi_in_device"); diff --git a/src/include/86box/midi.h b/src/include/86box/midi.h index 3eec73234..01ec88881 100644 --- a/src/include/86box/midi.h +++ b/src/include/86box/midi.h @@ -6,26 +6,26 @@ extern uint8_t MIDI_InSysexBuf[SYSEX_SIZE]; extern uint8_t MIDI_evt_len[256]; -extern int midi_device_current; +extern int midi_output_device_current; extern int midi_input_device_current; extern void (*input_msg)(void *p, uint8_t *msg, uint32_t len); extern int (*input_sysex)(void *p, uint8_t *buf, uint32_t len, int abort); extern void *midi_in_p; -extern int midi_device_available(int card); +extern int midi_out_device_available(int card); extern int midi_in_device_available(int card); #ifdef EMU_DEVICE_H -const device_t *midi_device_getdevice(int card); +const device_t *midi_out_device_getdevice(int card); const device_t *midi_in_device_getdevice(int card); #endif -extern int midi_device_has_config(int card); +extern int midi_out_device_has_config(int card); extern int midi_in_device_has_config(int card); -extern char *midi_device_get_internal_name(int card); +extern char *midi_out_device_get_internal_name(int card); extern char *midi_in_device_get_internal_name(int card); -extern int midi_device_get_from_internal_name(char *s); +extern int midi_out_device_get_from_internal_name(char *s); extern int midi_in_device_get_from_internal_name(char *s); -extern void midi_device_init(); +extern void midi_out_device_init(); extern void midi_in_device_init(); typedef struct midi_device_t { @@ -56,11 +56,11 @@ typedef struct midi_t { midi_device_t *m_out_device, *m_in_device; } midi_t; -extern midi_t *midi, *midi_in; +extern midi_t *midi_out, *midi_in; -extern void midi_init(midi_device_t *device); +extern void midi_out_init(midi_device_t *device); extern void midi_in_init(midi_device_t *device, midi_t **mididev); -extern void midi_close(); +extern void midi_out_close(); extern void midi_in_close(void); extern void midi_raw_out_rt_byte(uint8_t val); extern void midi_raw_out_thru_rt_byte(uint8_t val); @@ -90,7 +90,7 @@ extern void midi_in_sysex(uint8_t *buffer, uint32_t len); #define MIDI_INPUT_INTERNAL_NAME "midi_in" #ifdef EMU_DEVICE_H -extern const device_t rtmidi_device; +extern const device_t rtmidi_output_device; extern const device_t rtmidi_input_device; # ifdef USE_FLUIDSYNTH extern const device_t fluidsynth_device; diff --git a/src/include/86box/midi_rtmidi.h b/src/include/86box/midi_rtmidi.h index d2d3869e3..fb2074302 100644 --- a/src/include/86box/midi_rtmidi.h +++ b/src/include/86box/midi_rtmidi.h @@ -5,8 +5,8 @@ extern "C" { #endif -extern int rtmidi_get_num_devs(void); -extern void rtmidi_get_dev_name(int num, char *s); +extern int rtmidi_out_get_num_devs(void); +extern void rtmidi_out_get_dev_name(int num, char *s); extern int rtmidi_in_get_num_devs(void); extern void rtmidi_in_get_dev_name(int num, char *s); diff --git a/src/qt/qt_deviceconfig.cpp b/src/qt/qt_deviceconfig.cpp index 8e5ce3bef..faf5a6ddc 100644 --- a/src/qt/qt_deviceconfig.cpp +++ b/src/qt/qt_deviceconfig.cpp @@ -75,9 +75,9 @@ void DeviceConfig::ConfigureDevice(const _device_* device, int instance, Setting auto* model = cbox->model(); int currentIndex = -1; int selected = config_get_int(device_context.name, const_cast(config->name), config->default_int); - for (int i = 0; i < rtmidi_get_num_devs(); i++) { + for (int i = 0; i < rtmidi_out_get_num_devs(); i++) { char midiName[512] = { 0 }; - rtmidi_get_dev_name(i, midiName); + rtmidi_out_get_dev_name(i, midiName); Models::AddEntry(model, midiName, i); if (selected == i) { diff --git a/src/qt/qt_settingssound.cpp b/src/qt/qt_settingssound.cpp index 5cf1114b0..6b12023a6 100644 --- a/src/qt/qt_settingssound.cpp +++ b/src/qt/qt_settingssound.cpp @@ -45,7 +45,7 @@ SettingsSound::~SettingsSound() void SettingsSound::save() { sound_card_current = ui->comboBoxSoundCard->currentData().toInt(); - midi_device_current = ui->comboBoxMidiOut->currentData().toInt(); + midi_output_device_current = ui->comboBoxMidiOut->currentData().toInt(); midi_input_device_current = ui->comboBoxMidiIn->currentData().toInt(); mpu401_standalone_enable = ui->checkBoxMPU401->isChecked() ? 1 : 0; SSI2001 = ui->checkBoxSSI2001->isChecked() ? 1 : 0;; @@ -95,14 +95,14 @@ void SettingsSound::onCurrentMachineChanged(int machineId) { c = 0; selectedRow = 0; while (true) { - QString name = DeviceConfig::DeviceName(midi_device_getdevice(c), midi_device_get_internal_name(c), 0); + QString name = DeviceConfig::DeviceName(midi_out_device_getdevice(c), midi_out_device_get_internal_name(c), 0); if (name.isEmpty()) { break; } - if (midi_device_available(c)) { + if (midi_out_device_available(c)) { int row = Models::AddEntry(model, name, c); - if (c == midi_device_current) { + if (c == midi_output_device_current) { selectedRow = row - removeRows; } } @@ -118,7 +118,7 @@ void SettingsSound::onCurrentMachineChanged(int machineId) { c = 0; selectedRow = 0; while (true) { - QString name = DeviceConfig::DeviceName(midi_in_device_getdevice(c), midi_device_get_internal_name(c), 0); + QString name = DeviceConfig::DeviceName(midi_in_device_getdevice(c), midi_in_device_get_internal_name(c), 0); if (name.isEmpty()) { break; } @@ -154,7 +154,7 @@ void SettingsSound::onCurrentMachineChanged(int machineId) { } static bool allowMpu401(Ui::SettingsSound *ui) { - QString midiOut = midi_device_get_internal_name(ui->comboBoxMidiOut->currentData().toInt()); + QString midiOut = midi_out_device_get_internal_name(ui->comboBoxMidiOut->currentData().toInt()); QString midiIn = midi_in_device_get_internal_name(ui->comboBoxMidiIn->currentData().toInt()); if (midiOut.isEmpty()) { @@ -184,13 +184,13 @@ void SettingsSound::on_comboBoxMidiOut_currentIndexChanged(int index) { if (index < 0) { return; } - ui->pushButtonConfigureMidiOut->setEnabled(midi_device_has_config(ui->comboBoxMidiOut->currentData().toInt())); + ui->pushButtonConfigureMidiOut->setEnabled(midi_out_device_has_config(ui->comboBoxMidiOut->currentData().toInt())); ui->checkBoxMPU401->setEnabled(allowMpu401(ui) && (machine_has_bus(machineId, MACHINE_BUS_ISA) || machine_has_bus(machineId, MACHINE_BUS_MCA))); ui->pushButtonConfigureMPU401->setEnabled(allowMpu401(ui) && ui->checkBoxMPU401->isChecked()); } void SettingsSound::on_pushButtonConfigureMidiOut_clicked() { - DeviceConfig::ConfigureDevice(midi_device_getdevice(ui->comboBoxMidiOut->currentData().toInt()), 0, qobject_cast(Settings::settings)); + DeviceConfig::ConfigureDevice(midi_out_device_getdevice(ui->comboBoxMidiOut->currentData().toInt()), 0, qobject_cast(Settings::settings)); } void SettingsSound::on_comboBoxMidiIn_currentIndexChanged(int index) { diff --git a/src/sound/midi.c b/src/sound/midi.c index 67d2afceb..085dab873 100644 --- a/src/sound/midi.c +++ b/src/sound/midi.c @@ -31,12 +31,12 @@ #include <86box/midi.h> #include <86box/plat.h> -int midi_device_current = 0; -static int midi_device_last = 0; -int midi_input_device_current = 0; -static int midi_input_device_last = 0; +int midi_output_device_current = 0; +static int midi_output_device_last = 0; +int midi_input_device_current = 0; +static int midi_input_device_last = 0; -midi_t *midi = NULL, *midi_in = NULL; +midi_t *midi_out = NULL, *midi_in = NULL; midi_in_handler_t *mih_first = NULL, *mih_last = NULL, *mih_cur = NULL; @@ -69,9 +69,9 @@ uint8_t MIDI_evt_len[256] = { typedef struct { const device_t *device; -} MIDI_DEVICE, MIDI_IN_DEVICE; +} MIDI_OUT_DEVICE, MIDI_IN_DEVICE; -static const device_t midi_none_device = { +static const device_t midi_out_none_device = { "None", "none", 0, @@ -85,20 +85,20 @@ static const device_t midi_none_device = { NULL }; -static const MIDI_DEVICE devices[] = { +static const MIDI_OUT_DEVICE devices[] = { // clang-format off - { &midi_none_device }, + { &midi_out_none_device }, #ifdef USE_FLUIDSYNTH - { &fluidsynth_device }, + { &fluidsynth_device }, #endif #ifdef USE_MUNT - { &mt32_device }, - { &cm32l_device }, + { &mt32_device }, + { &cm32l_device }, #endif #ifdef USE_RTMIDI - { &rtmidi_device }, + { &rtmidi_output_device }, #endif - { NULL } + { NULL } // clang-format on }; @@ -127,7 +127,7 @@ static const MIDI_IN_DEVICE midi_in_devices[] = { }; int -midi_device_available(int card) +midi_out_device_available(int card) { if (devices[card].device) return device_available(devices[card].device); @@ -136,13 +136,13 @@ midi_device_available(int card) } const device_t * -midi_device_getdevice(int card) +midi_out_device_getdevice(int card) { return devices[card].device; } int -midi_device_has_config(int card) +midi_out_device_has_config(int card) { if (!devices[card].device) return 0; @@ -150,13 +150,13 @@ midi_device_has_config(int card) } char * -midi_device_get_internal_name(int card) +midi_out_device_get_internal_name(int card) { return device_get_internal_name(devices[card].device); } int -midi_device_get_from_internal_name(char *s) +midi_out_device_get_from_internal_name(char *s) { int c = 0; @@ -170,20 +170,20 @@ midi_device_get_from_internal_name(char *s) } void -midi_device_init() +midi_out_device_init() { - if (devices[midi_device_current].device) - device_add(devices[midi_device_current].device); - midi_device_last = midi_device_current; + if (devices[midi_output_device_current].device) + device_add(devices[midi_output_device_current].device); + midi_output_device_last = midi_output_device_current; } void -midi_init(midi_device_t *device) +midi_out_init(midi_device_t *device) { - midi = (midi_t *) malloc(sizeof(midi_t)); - memset(midi, 0, sizeof(midi_t)); + midi_out = (midi_t *) malloc(sizeof(midi_t)); + memset(midi_out, 0, sizeof(midi_t)); - midi->m_out_device = device; + midi_out->m_out_device = device; } void @@ -196,16 +196,16 @@ midi_in_init(midi_device_t *device, midi_t **mididev) } void -midi_close(void) +midi_out_close(void) { - if (midi && midi->m_out_device) { - free(midi->m_out_device); - midi->m_out_device = NULL; + if (midi_out && midi_out->m_out_device) { + free(midi_out->m_out_device); + midi_out->m_out_device = NULL; } - if (midi) { - free(midi); - midi = NULL; + if (midi_out) { + free(midi_out); + midi_out = NULL; } } @@ -226,22 +226,22 @@ midi_in_close(void) void midi_poll(void) { - if (midi && midi->m_out_device && midi->m_out_device->poll) - midi->m_out_device->poll(); + if (midi_out && midi_out->m_out_device && midi_out->m_out_device->poll) + midi_out->m_out_device->poll(); } void play_msg(uint8_t *msg) { - if (midi->m_out_device->play_msg) - midi->m_out_device->play_msg(msg); + if (midi_out->m_out_device->play_msg) + midi_out->m_out_device->play_msg(msg); } void play_sysex(uint8_t *sysex, unsigned int len) { - if (midi->m_out_device->play_sysex) - midi->m_out_device->play_sysex(sysex, len); + if (midi_out->m_out_device->play_sysex) + midi_out->m_out_device->play_sysex(sysex, len); } int @@ -324,69 +324,69 @@ midi_raw_out_byte(uint8_t val) { uint32_t passed_ticks; - if (!midi || !midi->m_out_device) + if (!midi_out || !midi_out->m_out_device) return; - if ((midi->m_out_device->write && midi->m_out_device->write(val))) + if ((midi_out->m_out_device->write && midi_out->m_out_device->write(val))) return; - if (midi->midi_sysex_start) { - passed_ticks = plat_get_ticks() - midi->midi_sysex_start; - if (passed_ticks < midi->midi_sysex_delay) - plat_delay_ms(midi->midi_sysex_delay - passed_ticks); + if (midi_out->midi_sysex_start) { + passed_ticks = plat_get_ticks() - midi_out->midi_sysex_start; + if (passed_ticks < midi_out->midi_sysex_delay) + plat_delay_ms(midi_out->midi_sysex_delay - passed_ticks); } /* Test for a realtime MIDI message */ if (val >= 0xf8) { - midi->midi_rt_buf[0] = val; - play_msg(midi->midi_rt_buf); + midi_out->midi_rt_buf[0] = val; + play_msg(midi_out->midi_rt_buf); return; } /* Test for a active sysex transfer */ - if (midi->midi_status == 0xf0) { + if (midi_out->midi_status == 0xf0) { if (!(val & 0x80)) { - if (midi->midi_pos < (SYSEX_SIZE - 1)) - midi->midi_sysex_data[midi->midi_pos++] = val; + if (midi_out->midi_pos < (SYSEX_SIZE - 1)) + midi_out->midi_sysex_data[midi_out->midi_pos++] = val; return; } else { - midi->midi_sysex_data[midi->midi_pos++] = 0xf7; + midi_out->midi_sysex_data[midi_out->midi_pos++] = 0xf7; - if ((midi->midi_sysex_start) && (midi->midi_pos >= 4) && (midi->midi_pos <= 9) && (midi->midi_sysex_data[1] == 0x41) && (midi->midi_sysex_data[3] == 0x16)) { + if ((midi_out->midi_sysex_start) && (midi_out->midi_pos >= 4) && (midi_out->midi_pos <= 9) && (midi_out->midi_sysex_data[1] == 0x41) && (midi_out->midi_sysex_data[3] == 0x16)) { /* pclog("MIDI: Skipping invalid MT-32 SysEx MIDI message\n"); */ } else { - play_sysex(midi->midi_sysex_data, midi->midi_pos); - if (midi->midi_sysex_start) { - if (midi->midi_sysex_data[5] == 0x7f) - midi->midi_sysex_delay = 290; /* All parameters reset */ - else if ((midi->midi_sysex_data[5] == 0x10) && (midi->midi_sysex_data[6] == 0x00) && (midi->midi_sysex_data[7] == 0x04)) - midi->midi_sysex_delay = 145; /* Viking Child */ - else if ((midi->midi_sysex_data[5] == 0x10) && (midi->midi_sysex_data[6] == 0x00) && (midi->midi_sysex_data[7] == 0x01)) - midi->midi_sysex_delay = 30; /* Dark Sun 1 */ + play_sysex(midi_out->midi_sysex_data, midi_out->midi_pos); + if (midi_out->midi_sysex_start) { + if (midi_out->midi_sysex_data[5] == 0x7f) + midi_out->midi_sysex_delay = 290; /* All parameters reset */ + else if ((midi_out->midi_sysex_data[5] == 0x10) && (midi_out->midi_sysex_data[6] == 0x00) && (midi_out->midi_sysex_data[7] == 0x04)) + midi_out->midi_sysex_delay = 145; /* Viking Child */ + else if ((midi_out->midi_sysex_data[5] == 0x10) && (midi_out->midi_sysex_data[6] == 0x00) && (midi_out->midi_sysex_data[7] == 0x01)) + midi_out->midi_sysex_delay = 30; /* Dark Sun 1 */ else - midi->midi_sysex_delay = (unsigned int) (((float) (midi->midi_pos) * 1.25f) * 1000.0f / 3125.0f) + 2; + midi_out->midi_sysex_delay = (unsigned int) (((float) (midi_out->midi_pos) * 1.25f) * 1000.0f / 3125.0f) + 2; - midi->midi_sysex_start = plat_get_ticks(); + midi_out->midi_sysex_start = plat_get_ticks(); } } } } if (val & 0x80) { - midi->midi_status = val; - midi->midi_cmd_pos = 0; - midi->midi_cmd_len = MIDI_evt_len[val]; - if (midi->midi_status == 0xf0) { - midi->midi_sysex_data[0] = 0xf0; - midi->midi_pos = 1; + midi_out->midi_status = val; + midi_out->midi_cmd_pos = 0; + midi_out->midi_cmd_len = MIDI_evt_len[val]; + if (midi_out->midi_status == 0xf0) { + midi_out->midi_sysex_data[0] = 0xf0; + midi_out->midi_pos = 1; } } - if (midi->midi_cmd_len) { - midi->midi_cmd_buf[midi->midi_cmd_pos++] = val; - if (midi->midi_cmd_pos >= midi->midi_cmd_len) { - play_msg(midi->midi_cmd_buf); - midi->midi_cmd_pos = 1; + if (midi_out->midi_cmd_len) { + midi_out->midi_cmd_buf[midi_out->midi_cmd_pos++] = val; + if (midi_out->midi_cmd_pos >= midi_out->midi_cmd_len) { + play_msg(midi_out->midi_cmd_buf); + midi_out->midi_cmd_pos = 1; } } } @@ -394,13 +394,13 @@ midi_raw_out_byte(uint8_t val) void midi_clear_buffer(void) { - if (!midi) + if (!midi_out) return; - midi->midi_pos = 0; - midi->midi_status = 0x00; - midi->midi_cmd_pos = 0; - midi->midi_cmd_len = 0; + midi_out->midi_pos = 0; + midi_out->midi_status = 0x00; + midi_out->midi_cmd_pos = 0; + midi_out->midi_cmd_len = 0; } void diff --git a/src/sound/midi_fluidsynth.c b/src/sound/midi_fluidsynth.c index 52d21ac47..dd450e856 100644 --- a/src/sound/midi_fluidsynth.c +++ b/src/sound/midi_fluidsynth.c @@ -317,7 +317,7 @@ fluidsynth_init(const device_t *info) dev->play_sysex = fluidsynth_sysex; dev->poll = fluidsynth_poll; - midi_init(dev); + midi_out_init(dev); data->on = 1; diff --git a/src/sound/midi_mt32.c b/src/sound/midi_mt32.c index c0a0bc81a..f4a4a493a 100644 --- a/src/sound/midi_mt32.c +++ b/src/sound/midi_mt32.c @@ -272,7 +272,7 @@ mt32emu_init(char *control_rom, char *pcm_rom) dev->play_sysex = mt32_sysex; dev->poll = mt32_poll; - midi_init(dev); + midi_out_init(dev); mt32_on = 1; diff --git a/src/sound/midi_rtmidi.cpp b/src/sound/midi_rtmidi.cpp index 352cdcdfc..5eaf5a964 100644 --- a/src/sound/midi_rtmidi.cpp +++ b/src/sound/midi_rtmidi.cpp @@ -66,7 +66,7 @@ rtmidi_play_sysex(uint8_t *sysex, unsigned int len) void* -rtmidi_init(const device_t *info) +rtmidi_output_init(const device_t *info) { midi_device_t* dev = (midi_device_t*)malloc(sizeof(midi_device_t)); memset(dev, 0, sizeof(midi_device_t)); @@ -99,14 +99,14 @@ rtmidi_init(const device_t *info) } } - midi_init(dev); + midi_out_init(dev); return dev; } void -rtmidi_close(void *p) +rtmidi_output_close(void *p) { if (!midiout) return; @@ -116,12 +116,12 @@ rtmidi_close(void *p) delete midiout; midiout = nullptr; - midi_close(); + midi_out_close(); } int -rtmidi_get_num_devs(void) +rtmidi_out_get_num_devs(void) { if (!midiout) { try { @@ -136,7 +136,7 @@ rtmidi_get_num_devs(void) void -rtmidi_get_dev_name(int num, char *s) +rtmidi_out_get_dev_name(int num, char *s) { strcpy(s, midiout->getPortName(num).c_str()); } @@ -207,7 +207,7 @@ rtmidi_input_close(void* p) delete midiin; midiin = nullptr; - midi_close(); + midi_out_close(); } @@ -232,8 +232,7 @@ rtmidi_in_get_dev_name(int num, char *s) strcpy(s, midiin->getPortName(num).c_str()); } -static const device_config_t system_midi_config[] = -{ +static const device_config_t system_midi_config[] = { { "midi", "MIDI out device", CONFIG_MIDI_OUT, "", 0 }, @@ -242,8 +241,7 @@ static const device_config_t system_midi_config[] = } }; -static const device_config_t midi_input_config[] = -{ +static const device_config_t midi_input_config[] = { { "midi_input", "MIDI in device", CONFIG_MIDI_IN, "", 0 }, @@ -261,15 +259,14 @@ static const device_config_t midi_input_config[] = } }; -const device_t rtmidi_device = -{ +const device_t rtmidi_output_device = { SYSTEM_MIDI_NAME, SYSTEM_MIDI_INTERNAL_NAME, 0, 0, - rtmidi_init, - rtmidi_close, + rtmidi_output_init, + rtmidi_output_close, NULL, - { rtmidi_get_num_devs }, + { rtmidi_out_get_num_devs }, NULL, NULL, system_midi_config diff --git a/src/sound/sound.c b/src/sound/sound.c index a1a3353c6..2783526d9 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -481,7 +481,7 @@ sound_reset(void) { sound_realloc_buffers(); - midi_device_init(); + midi_out_device_init(); midi_in_device_init(); inital(); diff --git a/src/sound/xaudio2.c b/src/sound/xaudio2.c index c7e8dbf8f..b26bb9c9f 100644 --- a/src/sound/xaudio2.c +++ b/src/sound/xaudio2.c @@ -167,7 +167,7 @@ inital() IXAudio2SourceVoice_Start(srcvoice, 0, XAUDIO2_COMMIT_NOW); IXAudio2SourceVoice_Start(srcvoicecd, 0, XAUDIO2_COMMIT_NOW); - char *mdn = midi_device_get_internal_name(midi_device_current); + char *mdn = midi_out_device_get_internal_name(midi_output_device_current); if (strcmp(mdn, "none") && strcmp(mdn, SYSTEM_MIDI_INTERNAL_NAME)) { fmt.nSamplesPerSec = midi_freq; diff --git a/src/win/win_devconf.c b/src/win/win_devconf.c index e69aa59f1..42197ff33 100644 --- a/src/win/win_devconf.c +++ b/src/win/win_devconf.c @@ -98,9 +98,9 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) val_int = config_get_int((char *) config_device.name, (char *) config->name, config->default_int); - num = rtmidi_get_num_devs(); + num = rtmidi_out_get_num_devs(); for (c = 0; c < num; c++) { - rtmidi_get_dev_name(c, s); + rtmidi_out_get_dev_name(c, s); mbstowcs(lptsTemp, s, strlen(s) + 1); SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp); if (val_int == c) diff --git a/src/win/win_settings.c b/src/win/win_settings.c index dcd8d33ad..e6b4226b6 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -91,7 +91,7 @@ static int temp_gfxcard, temp_voodoo; static int temp_mouse, temp_joystick; /* Sound category */ -static int temp_sound_card, temp_midi_device, temp_midi_input_device, temp_mpu401, temp_SSI2001, temp_GAMEBLASTER, temp_GUS; +static int temp_sound_card, temp_midi_output_device, temp_midi_input_device, temp_mpu401, temp_SSI2001, temp_GAMEBLASTER, temp_GUS; static int temp_float; /* Network category */ @@ -339,7 +339,7 @@ win_settings_init(void) /* Sound category */ temp_sound_card = sound_card_current; - temp_midi_device = midi_device_current; + temp_midi_output_device = midi_output_device_current; temp_midi_input_device = midi_input_device_current; temp_mpu401 = mpu401_standalone_enable; temp_SSI2001 = SSI2001; @@ -463,7 +463,7 @@ win_settings_changed(void) /* Sound category */ i = i || (sound_card_current != temp_sound_card); - i = i || (midi_device_current != temp_midi_device); + i = i || (midi_output_device_current != temp_midi_output_device); i = i || (midi_input_device_current != temp_midi_input_device); i = i || (mpu401_standalone_enable != temp_mpu401); i = i || (SSI2001 != temp_SSI2001); @@ -553,7 +553,7 @@ win_settings_save(void) /* Sound category */ sound_card_current = temp_sound_card; - midi_device_current = temp_midi_device; + midi_output_device_current = temp_midi_output_device; midi_input_device_current = temp_midi_input_device; mpu401_standalone_enable = temp_mpu401; SSI2001 = temp_SSI2001; @@ -1261,7 +1261,7 @@ mpu401_standalone_allow(void) if (!machine_has_bus(temp_machine, MACHINE_BUS_ISA) && !machine_has_bus(temp_machine, MACHINE_BUS_MCA)) return 0; - md = midi_device_get_internal_name(temp_midi_device); + md = midi_out_device_get_internal_name(temp_midi_output_device); mdin = midi_in_device_get_internal_name(temp_midi_input_device); if (md != NULL) { @@ -1327,18 +1327,18 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) c = d = 0; settings_reset_content(hdlg, IDC_COMBO_MIDI_OUT); while (1) { - generate_device_name(midi_device_getdevice(c), midi_device_get_internal_name(c), 0); + generate_device_name(midi_out_device_getdevice(c), midi_out_device_get_internal_name(c), 0); if (!device_name[0]) break; - if (midi_device_available(c)) { + if (midi_out_device_available(c)) { if (c == 0) settings_add_string(hdlg, IDC_COMBO_MIDI_OUT, win_get_string(IDS_2103)); else settings_add_string(hdlg, IDC_COMBO_MIDI_OUT, (LPARAM) device_name); settings_list_to_midi[d] = c; - if ((c == 0) || (c == temp_midi_device)) + if ((c == 0) || (c == temp_midi_output_device)) settings_set_cur_sel(hdlg, IDC_COMBO_MIDI_OUT, d); d++; } @@ -1346,7 +1346,7 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) c++; } - settings_enable_window(hdlg, IDC_CONFIGURE_MIDI_OUT, midi_device_has_config(temp_midi_device)); + settings_enable_window(hdlg, IDC_CONFIGURE_MIDI_OUT, midi_out_device_has_config(temp_midi_output_device)); c = d = 0; settings_reset_content(hdlg, IDC_COMBO_MIDI_IN); @@ -1405,16 +1405,16 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) break; case IDC_COMBO_MIDI_OUT: - temp_midi_device = settings_list_to_midi[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_OUT)]; - settings_enable_window(hdlg, IDC_CONFIGURE_MIDI_OUT, midi_device_has_config(temp_midi_device)); + temp_midi_output_device = settings_list_to_midi[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_OUT)]; + settings_enable_window(hdlg, IDC_CONFIGURE_MIDI_OUT, midi_out_device_has_config(temp_midi_output_device)); settings_set_check(hdlg, IDC_CHECK_MPU401, temp_mpu401); settings_enable_window(hdlg, IDC_CHECK_MPU401, mpu401_standalone_allow()); settings_enable_window(hdlg, IDC_CONFIGURE_MPU401, mpu401_standalone_allow() && temp_mpu401); break; case IDC_CONFIGURE_MIDI_OUT: - temp_midi_device = settings_list_to_midi[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_OUT)]; - temp_deviceconfig |= deviceconfig_open(hdlg, (void *)midi_device_getdevice(temp_midi_device)); + temp_midi_output_device = settings_list_to_midi[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_OUT)]; + temp_deviceconfig |= deviceconfig_open(hdlg, (void *)midi_out_device_getdevice(temp_midi_output_device)); break; case IDC_COMBO_MIDI_IN: @@ -1474,7 +1474,7 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_SAVESETTINGS: temp_sound_card = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_SOUND)]; - temp_midi_device = settings_list_to_midi[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_OUT)]; + temp_midi_output_device = settings_list_to_midi[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_OUT)]; temp_midi_input_device = settings_list_to_midi_in[settings_get_cur_sel(hdlg, IDC_COMBO_MIDI_IN)]; temp_mpu401 = settings_get_check(hdlg, IDC_CHECK_MPU401); temp_GAMEBLASTER = settings_get_check(hdlg, IDC_CHECK_CMS);