working on win32 uwp! and libremidi update
This commit is contained in:
@@ -14,6 +14,7 @@ class midi_in_jack final
|
||||
, public error_handler
|
||||
{
|
||||
public:
|
||||
using midi_api::client_open_;
|
||||
struct
|
||||
: input_configuration
|
||||
, jack_input_configuration
|
||||
@@ -24,8 +25,14 @@ public:
|
||||
: configuration{std::move(conf), std::move(apiconf)}
|
||||
{
|
||||
auto status = connect(*this);
|
||||
if (status != jack_status_t{})
|
||||
warning(configuration, "midi_in_jack: " + std::to_string((int)jack_status_t{}));
|
||||
if (!this->client)
|
||||
{
|
||||
libremidi_handle_error(configuration, "Could not create JACK client");
|
||||
client_open_ = from_jack_status(status);
|
||||
return;
|
||||
}
|
||||
|
||||
client_open_ = stdx::error{};
|
||||
}
|
||||
|
||||
~midi_in_jack() override
|
||||
@@ -35,39 +42,35 @@ public:
|
||||
disconnect(*this);
|
||||
}
|
||||
|
||||
void set_client_name(std::string_view) override
|
||||
{
|
||||
warning(configuration, "midi_in_jack: set_client_name unsupported");
|
||||
}
|
||||
|
||||
libremidi::API get_current_api() const noexcept override { return libremidi::API::JACK_MIDI; }
|
||||
|
||||
bool open_port(const input_port& port, std::string_view portName) override
|
||||
stdx::error open_port(const input_port& port, std::string_view portName) override
|
||||
{
|
||||
if (!create_local_port(*this, portName, JackPortIsInput))
|
||||
return false;
|
||||
if (auto err = create_local_port(*this, portName, JackPortIsInput); err != stdx::error{})
|
||||
return err;
|
||||
|
||||
if (auto ret = jack_connect(this->client, port.port_name.c_str(), jack_port_name(this->port));
|
||||
ret != 0)
|
||||
if (int err = jack_connect(this->client, port.port_name.c_str(), jack_port_name(this->port));
|
||||
err != 0 && err != EEXIST)
|
||||
{
|
||||
error<invalid_parameter_error>(
|
||||
configuration, "JACK: could not connect to port: " + port.port_name + " -> "
|
||||
libremidi_handle_error(
|
||||
configuration, "could not connect to port: " + port.port_name + " -> "
|
||||
+ jack_port_name(this->port));
|
||||
return false;
|
||||
return from_errc(err);
|
||||
}
|
||||
return true;
|
||||
return stdx::error{};
|
||||
}
|
||||
|
||||
bool open_virtual_port(std::string_view portName) override
|
||||
stdx::error open_virtual_port(std::string_view portName) override
|
||||
{
|
||||
return create_local_port(*this, portName, JackPortIsInput);
|
||||
}
|
||||
|
||||
void close_port() override { return do_close_port(); }
|
||||
stdx::error close_port() override { return do_close_port(); }
|
||||
|
||||
void set_port_name(std::string_view portName) override
|
||||
stdx::error set_port_name(std::string_view portName) override
|
||||
{
|
||||
jack_port_rename(this->client, this->port, portName.data());
|
||||
int ret = jack_port_rename(this->client, this->port, portName.data());
|
||||
return from_errc(ret);
|
||||
}
|
||||
|
||||
timestamp absolute_timestamp() const noexcept override
|
||||
|
||||
Reference in New Issue
Block a user