working on win32 uwp! and libremidi update
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
#pragma once
|
||||
#include <libremidi/config.hpp>
|
||||
|
||||
#include <any>
|
||||
#include <tuple>
|
||||
|
||||
#if !__has_include(<weak_libjack.h>) && !__has_include(<jack/jack.h>)
|
||||
@@ -44,9 +47,10 @@
|
||||
|
||||
#if defined(LIBREMIDI_WINUWP)
|
||||
#include <libremidi/backends/winuwp.hpp>
|
||||
#if __has_include(<winrt/Microsoft.Devices.Midi2.h>)
|
||||
#include <libremidi/backends/winmidi.hpp>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBREMIDI_WINMIDI)
|
||||
#include <libremidi/backends/winmidi.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(LIBREMIDI_EMSCRIPTEN)
|
||||
@@ -55,6 +59,15 @@
|
||||
|
||||
#include <libremidi/backends/dummy.hpp>
|
||||
|
||||
#if defined(LIBREMIDI_KEYBOARD)
|
||||
#include <libremidi/backends/keyboard.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(LIBREMIDI_NETWORK)
|
||||
#include <libremidi/backends/network.hpp>
|
||||
#include <libremidi/backends/network_ump.hpp>
|
||||
#endif
|
||||
|
||||
namespace libremidi
|
||||
{
|
||||
// The order here will control the order of the API search in
|
||||
@@ -100,6 +113,14 @@ static constexpr auto available_backends = make_tl(
|
||||
#if defined(LIBREMIDI_PIPEWIRE)
|
||||
,
|
||||
pipewire::backend{}
|
||||
#endif
|
||||
#if defined(LIBREMIDI_KEYBOARD)
|
||||
,
|
||||
kbd_backend{}
|
||||
#endif
|
||||
#if defined(LIBREMIDI_NETWORK)
|
||||
,
|
||||
net::backend{}
|
||||
#endif
|
||||
,
|
||||
dummy_backend{});
|
||||
@@ -135,15 +156,13 @@ static constexpr auto available_backends = make_tl(
|
||||
,
|
||||
coremidi_ump::backend{}
|
||||
#endif
|
||||
#if defined(LIBREMIDI_JACK)
|
||||
#endif
|
||||
#if defined(LIBREMIDI_WINUWP)
|
||||
#if __has_include(<winrt/Microsoft.Devices.Midi2.h>)
|
||||
#if defined(LIBREMIDI_WINMIDI)
|
||||
,
|
||||
winmidi::backend{}
|
||||
#endif
|
||||
#endif
|
||||
#if defined(LIBREMIDI_EMSCRIPTEN)
|
||||
#if defined(LIBREMIDI_NETWORK)
|
||||
,
|
||||
net_ump::backend{}
|
||||
#endif
|
||||
,
|
||||
dummy_backend{});
|
||||
@@ -183,5 +202,49 @@ auto for_backend(libremidi::API api, F&& f)
|
||||
midi2::for_backend(api, f);
|
||||
}
|
||||
|
||||
void for_input_configuration(auto f, std::any& api_conf)
|
||||
{
|
||||
auto from_api = [&]<typename T>(T& /*backend*/) mutable {
|
||||
if (auto conf = std::any_cast<typename T::midi_in_configuration>(&api_conf))
|
||||
{
|
||||
f(*conf);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
if (std::apply([&](auto&&... b) { return (from_api(b) || ...); }, midi1::available_backends))
|
||||
return;
|
||||
std::apply([&](auto&&... b) { return (from_api(b) || ...); }, midi2::available_backends);
|
||||
}
|
||||
|
||||
void for_output_configuration(auto f, std::any& api_conf)
|
||||
{
|
||||
auto from_api = [&]<typename T>(T& /*backend*/) mutable {
|
||||
if (auto conf = std::any_cast<typename T::midi_out_configuration>(&api_conf))
|
||||
{
|
||||
f(*conf);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
if (std::apply([&](auto&&... b) { return (from_api(b) || ...); }, midi1::available_backends))
|
||||
return;
|
||||
std::apply([&](auto&&... b) { return (from_api(b) || ...); }, midi2::available_backends);
|
||||
}
|
||||
|
||||
void for_observer_configuration(auto f, std::any& api_conf)
|
||||
{
|
||||
auto from_api = [&]<typename T>(T& /*backend*/) mutable {
|
||||
if (auto conf = std::any_cast<typename T::midi_observer_configuration>(&api_conf))
|
||||
{
|
||||
f(*conf);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
if (std::apply([&](auto&&... b) { return (from_api(b) || ...); }, midi1::available_backends))
|
||||
return;
|
||||
std::apply([&](auto&&... b) { return (from_api(b) || ...); }, midi2::available_backends);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user