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
@@ -8,12 +8,14 @@ LIBREMIDI_INLINE midi_out_emscripten::midi_out_emscripten(
output_configuration&& conf, emscripten_output_configuration&& apiconf)
: configuration{std::move(conf), std::move(apiconf)}
{
client_open_ = stdx::error{};
}
LIBREMIDI_INLINE midi_out_emscripten::~midi_out_emscripten()
{
// Close a connection if it exists.
midi_out_emscripten::close_port();
client_open_ = std::errc::not_connected;
}
LIBREMIDI_INLINE libremidi::API midi_out_emscripten::get_current_api() const noexcept
@@ -21,54 +23,41 @@ LIBREMIDI_INLINE libremidi::API midi_out_emscripten::get_current_api() const noe
return libremidi::API::WEBMIDI;
}
LIBREMIDI_INLINE bool midi_out_emscripten::open_port(unsigned int portNumber, std::string_view)
LIBREMIDI_INLINE stdx::error midi_out_emscripten::open_port(int portNumber, std::string_view)
{
auto& midi = webmidi_helpers::midi_access_emscripten::instance();
if (portNumber >= midi.output_count())
{
error<no_devices_found_error>(
this->configuration, "midi_out_emscripten::open_port: no MIDI output sources found.");
return false;
libremidi_handle_error(
this->configuration, "no MIDI output sources found.");
return std::errc::invalid_argument;
}
portNumber_ = portNumber;
return true;
return stdx::error{};
}
LIBREMIDI_INLINE bool midi_out_emscripten::open_port(const output_port& p, std::string_view nm)
LIBREMIDI_INLINE stdx::error midi_out_emscripten::open_port(const output_port& p, std::string_view nm)
{
return open_port(p.port, nm);
}
LIBREMIDI_INLINE void midi_out_emscripten::close_port() { }
LIBREMIDI_INLINE void midi_out_emscripten::set_client_name(std::string_view clientName)
{
warning(configuration, "midi_out_emscripten::set_client_name: unsupported.");
LIBREMIDI_INLINE stdx::error midi_out_emscripten::close_port() {
return stdx::error{};
}
LIBREMIDI_INLINE void midi_out_emscripten::set_port_name(std::string_view portName)
{
warning(configuration, "midi_out_emscripten::set_port_name: unsupported.");
}
LIBREMIDI_INLINE bool midi_out_emscripten::open_virtual_port(std::string_view)
{
warning(configuration, "midi_in_emscripten::open_virtual_port: unsupported.");
return false;
}
LIBREMIDI_INLINE void midi_out_emscripten::send_message(const unsigned char* message, size_t size)
LIBREMIDI_INLINE stdx::error midi_out_emscripten::send_message(const unsigned char* message, size_t size)
{
if (portNumber_ < 0)
error<invalid_use_error>(
libremidi_handle_error(
this->configuration,
"midi_out_emscripten::send_message: trying to send a message without an open "
"trying to send a message without an open "
"port.");
webmidi_helpers::midi_access_emscripten::instance().send_message(
portNumber_, reinterpret_cast<const char*>(message), size);
return stdx::error{};
}
}
#endif