working on win32 uwp! and libremidi update

This commit is contained in:
Sebastian @ HfG
2024-10-28 19:24:18 +01:00
parent 06cb6d8319
commit 1e3755148c
106 changed files with 8474 additions and 2198 deletions
+35 -27
View File
@@ -69,7 +69,6 @@
#include <midi/universal_packet.h>
#endif
#include <any>
#include <optional>
namespace libremidi
{
@@ -132,19 +131,20 @@ public:
[[nodiscard]] libremidi::API get_current_api() const noexcept;
//! Open a MIDI input connection
void open_port(const input_port& pt, std::string_view local_port_name = "libremidi input");
stdx::error
open_port(const input_port& pt, std::string_view local_port_name = "libremidi input");
//! Create a virtual input port, with optional name, to allow software
//! connections.
//!
//! \param portName An optional name for the application port that is
//! used to connect to portId can be specified.
void open_virtual_port(std::string_view portName = "libremidi virtual port");
stdx::error open_virtual_port(std::string_view portName = "libremidi virtual port");
void set_port_name(std::string_view portName);
stdx::error set_port_name(std::string_view portName);
//! Close an open MIDI connection (if one exists).
void close_port();
stdx::error close_port();
//! Returns true if a port has been opened successfully with open_port or open_virtual_port
[[nodiscard]] bool is_port_open() const noexcept;
@@ -182,11 +182,11 @@ public:
[[nodiscard]] libremidi::API get_current_api() const noexcept;
//! Open a MIDI output connection.
void
stdx::error
open_port(const output_port& pt, std::string_view local_port_name = "libremidi output") const;
//! Close an open MIDI connection (if one exists).
void close_port() const;
stdx::error close_port() const;
//! Returns true if a port has been opened successfully with open_port or open_virtual_port
[[nodiscard]] bool is_port_open() const noexcept;
@@ -200,48 +200,56 @@ public:
//!
//! \param portName An optional name for the application port that is
//! used to connect to portId can be specified.
void open_virtual_port(std::string_view portName = "libremidi virtual port") const;
stdx::error open_virtual_port(std::string_view portName = "libremidi virtual port") const;
void set_port_name(std::string_view portName) const;
stdx::error set_port_name(std::string_view portName) const;
//! Immediately send a single message out an open MIDI output port.
/*!
An exception is thrown if an error occurs during output or an
output connection was not previously established.
*/
void send_message(const libremidi::message& message) const;
stdx::error send_message(const libremidi::message& message) const;
//! Immediately send a single message to an open MIDI output port.
void send_message(const unsigned char* message, size_t size) const;
void send_message(std::span<const unsigned char>) const;
void send_message(unsigned char b0) const;
void send_message(unsigned char b0, unsigned char b1) const;
void send_message(unsigned char b0, unsigned char b1, unsigned char b2) const;
stdx::error send_message(const unsigned char* message, size_t size) const;
stdx::error send_message(std::span<const unsigned char>) const;
stdx::error send_message(unsigned char b0) const;
stdx::error send_message(unsigned char b0, unsigned char b1) const;
stdx::error send_message(unsigned char b0, unsigned char b1, unsigned char b2) const;
// Avoid silly mistakes:
stdx::error send_message(auto* message) const noexcept = delete;
stdx::error send_message(const auto* message) const noexcept = delete;
//! Current time in the timestamp referential
int64_t current_time();
//! Try to schedule a message later in time if the underlying API supports it
//! (currently not implemented anywhere)
void schedule_message(int64_t timestamp, const unsigned char* message, size_t size);
stdx::error schedule_message(int64_t timestamp, const unsigned char* message, size_t size) const;
//! Immediately send a single UMP packet to an open MIDI output port.
void send_ump(const uint32_t* message, size_t size) const;
void send_ump(const libremidi::ump&) const;
void send_ump(std::span<const uint32_t>) const;
void send_ump(uint32_t b0) const;
void send_ump(uint32_t b0, uint32_t b1) const;
void send_ump(uint32_t b0, uint32_t b1, uint32_t b2) const;
void send_ump(uint32_t b0, uint32_t b1, uint32_t b2, uint32_t b3) const;
stdx::error send_ump(const uint32_t* message, size_t size) const;
stdx::error send_ump(const libremidi::ump&) const;
stdx::error send_ump(std::span<const uint32_t>) const;
stdx::error send_ump(uint32_t b0) const;
stdx::error send_ump(uint32_t b0, uint32_t b1) const;
stdx::error send_ump(uint32_t b0, uint32_t b1, uint32_t b2) const;
stdx::error send_ump(uint32_t b0, uint32_t b1, uint32_t b2, uint32_t b3) const;
// Better compat with cmidi2
stdx::error send_ump(int32_t b0) const;
stdx::error send_ump(int64_t b01) const;
stdx::error send_ump(uint64_t b01) const;
// Interop with ni-midi2
#if LIBREMIDI_NI_MIDI2_COMPAT
void send_ump(const midi::universal_packet& pkt) const { send_ump(pkt.data, pkt.size()); }
void send_ump(const midi::sysex7& msg, int group = 0)
stdx::error send_ump(const midi::universal_packet& pkt) const { send_ump(pkt.data, pkt.size()); }
stdx::error send_ump(const midi::sysex7& msg, int group = 0)
{
midi::send_sysex7(msg, group, [&](const midi::sysex7_packet& x) { send_ump(x.data); });
}
void send_ump(const midi::sysex8& msg, int stream, int group = 0)
stdx::error send_ump(const midi::sysex8& msg, int stream, int group = 0)
{
midi::send_sysex8(msg, stream, group, [&](const midi::sysex8_packet& x) { send_ump(x.data); });
}
@@ -249,7 +257,7 @@ public:
//! Try to schedule an UMP packet later in time if the underlying API supports it
//! (currently not implemented anywhere)
void schedule_ump(int64_t timestamp, const uint32_t* message, size_t size);
stdx::error schedule_ump(int64_t timestamp, const uint32_t* message, size_t size) const;
private:
std::unique_ptr<class midi_out_api> impl_;