Files
86Box/src/sound/midi_system.c

139 lines
2.7 KiB
C
Raw Normal View History

#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include <86box/86box.h>
#include <86box/device.h>
#include <86box/plat.h>
#include <86box/plat_midi.h>
#include <86box/midi.h>
#include <86box/midi_input.h>
void* system_midi_init(const device_t *info)
{
midi_device_t* dev = malloc(sizeof(midi_device_t));
memset(dev, 0, sizeof(midi_device_t));
dev->play_msg = plat_midi_play_msg;
dev->play_sysex = plat_midi_play_sysex;
dev->write = plat_midi_write;
plat_midi_init();
midi_init(dev);
return dev;
}
2020-01-01 20:20:16 +01:00
void* midi_input_init(const device_t *info)
{
midi_device_t* dev = malloc(sizeof(midi_device_t));
memset(dev, 0, sizeof(midi_device_t));
plat_midi_input_init();
midi_in_init(dev, &midi_in);
2020-01-01 20:20:16 +01:00
midi_in->midi_realtime = device_get_config_int("realtime");
midi_in->thruchan = device_get_config_int("thruchan");
midi_in->midi_clockout = device_get_config_int("clockout");
2020-01-01 20:20:16 +01:00
return dev;
}
void system_midi_close(void* p)
{
plat_midi_close();
midi_close();
}
2020-01-01 20:20:16 +01:00
void midi_input_close(void* p)
{
plat_midi_input_close();
midi_close();
}
int system_midi_available(void)
{
return plat_midi_get_num_devs();
}
2020-01-01 20:20:16 +01:00
int midi_input_available(void)
{
return plat_midi_in_get_num_devs();
}
static const device_config_t system_midi_config[] =
{
{
.name = "midi",
.description = "MIDI out device",
.type = CONFIG_MIDI,
.default_int = 0
},
{
.type = -1
}
};
2020-01-01 20:20:16 +01:00
static const device_config_t midi_input_config[] =
{
{
.name = "midi_input",
.description = "MIDI in device",
.type = CONFIG_MIDI_IN,
.default_int = 0
},
{
.name = "realtime",
.description = "MIDI Real time",
.type = CONFIG_BINARY,
.default_int = 0
},
{
.name = "thruchan",
.description = "MIDI Thru",
.type = CONFIG_BINARY,
.default_int = 1
},
{
.name = "clockout",
.description = "MIDI Clockout",
.type = CONFIG_BINARY,
.default_int = 1
},
{
.type = -1
}
};
const device_t system_midi_device =
{
SYSTEM_MIDI_NAME,
0, 0,
system_midi_init,
system_midi_close,
NULL,
WARNING: CONFIGS MIGHT PARTIALLY BREAK WHERE DEVICE NAMES HAVE CHANGED. Changes to device_t struct to accomodate the upcoming PCI IRQ arbitration rewrite; Added device.c/h API to obtain name from the device_t struct; Significant changes to win/win_settings.c to clean up the code a bit and fix bugs; Ported all the CPU and AudioPCI commits from PCem; Added an API call to allow ACPI soft power off to gracefully stop the emulator; Removed the Siemens PCD-2L from the Dev branch because it now works; Removed the Socket 5 HP Vectra from the Dev branch because it now works; Fixed the Compaq Presario and the Micronics Spitfire; Give the IBM PC330 its own list of 486 CPU so it can have DX2's with CPUID 0x470; SMM fixes; Rewrote the SYSENTER, SYSEXIT, SYSCALL, and SYSRET instructions; Changed IDE reset period to match the specification, fixes #929; The keyboard input and output ports are now forced in front of the queue when read, fixes a number of bugs, including the AMI Apollo hanging on soft reset; Added the Intel AN430TX but Dev branched because it does not work; The network code no longer drops packets if the emulated network card has failed to receive them (eg. when the buffer is full); Changes to PCI card adding and renamed some PCI slot types, also added proper AGP bridge slot types; USB UHCI emulation is no longer a stub (still doesn't fully work, but at least Windows XP chk with Debug no longer ASSERT's on it); Fixed NVR on the the SMC FDC37C932QF and APM variants; A number of fixes to Intel 4x0 chipsets, including fixing every register of the 440LX and 440EX; Some ACPI changes.
2020-11-16 00:01:21 +01:00
{ system_midi_available },
NULL,
NULL,
system_midi_config
};
2020-01-01 20:20:16 +01:00
const device_t midi_input_device =
{
MIDI_INPUT_NAME,
0, 0,
midi_input_init,
midi_input_close,
NULL,
WARNING: CONFIGS MIGHT PARTIALLY BREAK WHERE DEVICE NAMES HAVE CHANGED. Changes to device_t struct to accomodate the upcoming PCI IRQ arbitration rewrite; Added device.c/h API to obtain name from the device_t struct; Significant changes to win/win_settings.c to clean up the code a bit and fix bugs; Ported all the CPU and AudioPCI commits from PCem; Added an API call to allow ACPI soft power off to gracefully stop the emulator; Removed the Siemens PCD-2L from the Dev branch because it now works; Removed the Socket 5 HP Vectra from the Dev branch because it now works; Fixed the Compaq Presario and the Micronics Spitfire; Give the IBM PC330 its own list of 486 CPU so it can have DX2's with CPUID 0x470; SMM fixes; Rewrote the SYSENTER, SYSEXIT, SYSCALL, and SYSRET instructions; Changed IDE reset period to match the specification, fixes #929; The keyboard input and output ports are now forced in front of the queue when read, fixes a number of bugs, including the AMI Apollo hanging on soft reset; Added the Intel AN430TX but Dev branched because it does not work; The network code no longer drops packets if the emulated network card has failed to receive them (eg. when the buffer is full); Changes to PCI card adding and renamed some PCI slot types, also added proper AGP bridge slot types; USB UHCI emulation is no longer a stub (still doesn't fully work, but at least Windows XP chk with Debug no longer ASSERT's on it); Fixed NVR on the the SMC FDC37C932QF and APM variants; A number of fixes to Intel 4x0 chipsets, including fixing every register of the 440LX and 440EX; Some ACPI changes.
2020-11-16 00:01:21 +01:00
{ midi_input_available },
2020-01-01 20:20:16 +01:00
NULL,
NULL,
midi_input_config
};