Clean up the RtMidi optionality
This commit is contained in:
@@ -109,6 +109,11 @@ if(WIN32)
|
||||
add_compile_definitions(_WINSOCK_DEPRECATED_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
if(HAIKU)
|
||||
set(OPENAL ON)
|
||||
set(RTMIDI OFF)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
||||
|
||||
@@ -118,13 +123,8 @@ set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
||||
# ------ ----------- ----
|
||||
option(RELEASE "Release build" OFF)
|
||||
option(DYNAREC "Dynamic recompiler" ON)
|
||||
if (HAIKU)
|
||||
option(OPENAL "OpenAL" ON)
|
||||
option(SYSTEM_MIDI "System MIDI" OFF)
|
||||
else()
|
||||
option(OPENAL "OpenAL" OFF)
|
||||
option(SYSTEM_MIDI "System MIDI" ON)
|
||||
endif()
|
||||
option(RTMIDI "RtMidi" ON)
|
||||
option(FLUIDSYNTH "FluidSynth" ON)
|
||||
option(MUNT "MUNT" ON)
|
||||
option(DINPUT "DirectInput" OFF)
|
||||
|
@@ -100,22 +100,6 @@ find_package(PNG REQUIRED)
|
||||
include_directories(${PNG_INCLUDE_DIRS})
|
||||
target_link_libraries(86Box PNG::PNG)
|
||||
|
||||
if(SYSTEM_MIDI)
|
||||
if(VCPKG_TOOLCHAIN)
|
||||
# vcpkg includes a config file for rtmidi
|
||||
find_package(RtMidi REQUIRED)
|
||||
target_link_libraries(86Box RtMidi::rtmidi)
|
||||
else()
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(RTMIDI REQUIRED IMPORTED_TARGET rtmidi)
|
||||
target_link_libraries(86Box PkgConfig::RTMIDI)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(PkgConfig::RTMIDI INTERFACE winmm)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
configure_file(include/86box/version.h.in include/86box/version.h @ONLY)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||
|
||||
|
@@ -141,6 +141,11 @@ add_library(ui STATIC
|
||||
)
|
||||
|
||||
|
||||
if(RTMIDI)
|
||||
target_compile_definitions(ui PRIVATE USE_RTMIDI)
|
||||
endif()
|
||||
|
||||
|
||||
if(WIN32)
|
||||
enable_language(RC)
|
||||
target_sources(86Box PUBLIC ../win/86Box-qt.rc)
|
||||
|
@@ -67,6 +67,7 @@ void DeviceConfig::ConfigureDevice(const _device_* device, int instance, Setting
|
||||
dc.ui->formLayout->addRow(config->description, cbox);
|
||||
break;
|
||||
}
|
||||
#ifdef USE_RTMIDI
|
||||
case CONFIG_MIDI_OUT:
|
||||
{
|
||||
auto* cbox = new QComboBox();
|
||||
@@ -107,6 +108,7 @@ void DeviceConfig::ConfigureDevice(const _device_* device, int instance, Setting
|
||||
cbox->setCurrentIndex(currentIndex);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case CONFIG_SELECTION:
|
||||
case CONFIG_HEX16:
|
||||
case CONFIG_HEX20:
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#
|
||||
|
||||
add_library(snd OBJECT sound.c snd_opl.c snd_opl_nuked.c snd_resid.cc
|
||||
midi.c midi_rtmidi.cpp snd_speaker.c snd_pssj.c snd_lpt_dac.c snd_ac97_codec.c snd_ac97_via.c
|
||||
midi.c snd_speaker.c snd_pssj.c snd_lpt_dac.c snd_ac97_codec.c snd_ac97_via.c
|
||||
snd_lpt_dss.c snd_ps1.c snd_adlib.c snd_adlibgold.c snd_ad1848.c snd_audiopci.c
|
||||
snd_azt2316a.c snd_cms.c snd_cs423x.c snd_gus.c snd_sb.c snd_sb_dsp.c
|
||||
snd_emu8k.c snd_mpu401.c snd_sn76489.c snd_ssi2001.c snd_wss.c snd_ym7128.c)
|
||||
@@ -62,8 +62,23 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SYSTEM_MIDI)
|
||||
target_compile_definitions(snd PRIVATE SYSTEM_MIDI)
|
||||
if(RTMIDI)
|
||||
if(VCPKG_TOOLCHAIN)
|
||||
# vcpkg includes a config file for rtmidi
|
||||
find_package(RtMidi REQUIRED)
|
||||
target_link_libraries(86Box RtMidi::rtmidi)
|
||||
else()
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(RTMIDI REQUIRED IMPORTED_TARGET rtmidi)
|
||||
target_link_libraries(86Box PkgConfig::RTMIDI)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(PkgConfig::RTMIDI INTERFACE winmm)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_compile_definitions(snd PRIVATE USE_RTMIDI)
|
||||
target_sources(snd PRIVATE midi_rtmidi.cpp)
|
||||
endif()
|
||||
|
||||
if(FLUIDSYNTH)
|
||||
|
@@ -95,7 +95,9 @@ static const MIDI_DEVICE devices[] = {
|
||||
{ &mt32_device },
|
||||
{ &cm32l_device },
|
||||
#endif
|
||||
#ifdef USE_RTMIDI
|
||||
{ &rtmidi_device },
|
||||
#endif
|
||||
{ NULL }
|
||||
// clang-format on
|
||||
};
|
||||
@@ -117,7 +119,9 @@ static const device_t midi_in_none_device = {
|
||||
static const MIDI_IN_DEVICE midi_in_devices[] = {
|
||||
// clang-format off
|
||||
{ &midi_in_none_device },
|
||||
#ifdef USE_RTMIDI
|
||||
{ &rtmidi_input_device },
|
||||
#endif
|
||||
{ NULL }
|
||||
// clang-format on
|
||||
};
|
||||
|
@@ -14,14 +14,12 @@
|
||||
* Copyright 2021 Miran Grca.
|
||||
*/
|
||||
|
||||
#ifdef SYSTEM_MIDI
|
||||
# if defined __has_include
|
||||
# if __has_include (<RtMidi.h>)
|
||||
# include <RtMidi.h>
|
||||
# endif
|
||||
# if __has_include (<rtmidi/RtMidi.h>)
|
||||
# include <rtmidi/RtMidi.h>
|
||||
# endif
|
||||
#if defined __has_include
|
||||
# if __has_include (<RtMidi.h>)
|
||||
# include <RtMidi.h>
|
||||
# endif
|
||||
# if __has_include (<rtmidi/RtMidi.h>)
|
||||
# include <rtmidi/RtMidi.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -38,11 +36,9 @@ extern "C"
|
||||
#include <86box/midi_rtmidi.h>
|
||||
#include <86box/config.h>
|
||||
|
||||
#ifdef SYSTEM_MIDI
|
||||
static RtMidiOut * midiout = nullptr;
|
||||
static RtMidiIn * midiin = nullptr;
|
||||
#endif
|
||||
static int midi_out_id = 0, midi_in_id = 0;
|
||||
static RtMidiOut * midiout = nullptr;
|
||||
static RtMidiIn * midiin = nullptr;
|
||||
static int midi_out_id = 0, midi_in_id = 0;
|
||||
static const int midi_lengths[8] = {3, 3, 3, 3, 2, 2, 3, 1};
|
||||
|
||||
|
||||
@@ -53,7 +49,6 @@ rtmidi_write(uint8_t val)
|
||||
}
|
||||
|
||||
|
||||
#ifdef SYSTEM_MIDI
|
||||
void
|
||||
rtmidi_play_msg(uint8_t *msg)
|
||||
{
|
||||
@@ -236,76 +231,6 @@ rtmidi_in_get_dev_name(int num, char *s)
|
||||
{
|
||||
strcpy(s, midiin->getPortName(num).c_str());
|
||||
}
|
||||
#else /* !SYSTEM_MIDI */
|
||||
void
|
||||
rtmidi_play_msg(uint8_t *msg)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rtmidi_play_sysex(uint8_t *sysex, unsigned int len)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
rtmidi_init(const device_t *info)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rtmidi_close(void *p)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rtmidi_get_num_devs(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rtmidi_get_dev_name(int num, char *s)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
rtmidi_input_init(const device_t *info)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rtmidi_input_close(void* p)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rtmidi_in_get_num_devs(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rtmidi_in_get_dev_name(int num, char *s)
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static const device_config_t system_midi_config[] =
|
||||
{
|
||||
|
@@ -93,6 +93,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
#ifdef USE_RTMIDI
|
||||
case CONFIG_MIDI_OUT:
|
||||
val_int = config_get_int((char *) config_device.name,
|
||||
(char *) config->name, config->default_int);
|
||||
@@ -123,6 +124,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
#endif
|
||||
case CONFIG_SPINNER:
|
||||
val_int = config_get_int((char *) config_device.name,
|
||||
(char *) config->name, config->default_int);
|
||||
|
Reference in New Issue
Block a user