diff options
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/Driver.hpp | 2 | ||||
-rw-r--r-- | src/engine/JackAudioDriver.cpp | 10 | ||||
-rw-r--r-- | src/engine/JackAudioDriver.hpp | 2 | ||||
-rw-r--r-- | src/engine/JackMidiDriver.cpp | 11 | ||||
-rw-r--r-- | src/engine/JackMidiDriver.hpp | 2 | ||||
-rw-r--r-- | src/engine/events/Move.cpp | 2 | ||||
-rw-r--r-- | src/engine/util.hpp | 7 |
7 files changed, 30 insertions, 6 deletions
diff --git a/src/engine/Driver.hpp b/src/engine/Driver.hpp index 9445d9dd..7a268e3c 100644 --- a/src/engine/Driver.hpp +++ b/src/engine/Driver.hpp @@ -44,7 +44,7 @@ public: virtual ~DriverPort() {} /** Set the name of the system port */ - virtual void set_name(const std::string& name) = 0; + virtual void move(const Raul::Path& path) = 0; virtual void create() = 0; virtual void destroy() = 0; diff --git a/src/engine/JackAudioDriver.cpp b/src/engine/JackAudioDriver.cpp index 05b0c45b..d4c4da25 100644 --- a/src/engine/JackAudioDriver.cpp +++ b/src/engine/JackAudioDriver.cpp @@ -70,7 +70,8 @@ void JackAudioPort::create() { _jack_port = jack_port_register(_driver->jack_client(), - _patch_port->path().chop_start("/").c_str(), JACK_DEFAULT_AUDIO_TYPE, + ingen_jack_port_name(_patch_port->path()).c_str(), + JACK_DEFAULT_AUDIO_TYPE, (_patch_port->is_input()) ? JackPortIsInput : JackPortIsOutput, 0); @@ -92,6 +93,13 @@ JackAudioPort::destroy() void +JackAudioPort::move(const Raul::Path& path) +{ + jack_port_set_name(_jack_port, ingen_jack_port_name(path).c_str()); +} + + +void JackAudioPort::pre_process(jack_nframes_t nframes) { if (!is_input()) diff --git a/src/engine/JackAudioDriver.hpp b/src/engine/JackAudioDriver.hpp index 9681dd71..02a60601 100644 --- a/src/engine/JackAudioDriver.hpp +++ b/src/engine/JackAudioDriver.hpp @@ -53,7 +53,7 @@ public: void create(); void destroy(); - void set_name(const std::string& name) { jack_port_set_name(_jack_port, name.c_str()); }; + void move(const Raul::Path& path); void pre_process(jack_nframes_t nframes); void post_process(jack_nframes_t nframes); diff --git a/src/engine/JackMidiDriver.cpp b/src/engine/JackMidiDriver.cpp index 6de97f68..a1c76f99 100644 --- a/src/engine/JackMidiDriver.cpp +++ b/src/engine/JackMidiDriver.cpp @@ -33,6 +33,7 @@ #include "ProcessContext.hpp" #include "Engine.hpp" #include "jack_compat.h" +#include "util.hpp" using namespace std; using namespace Raul; @@ -66,7 +67,8 @@ void JackMidiPort::create() { _jack_port = jack_port_register(_driver->jack_client(), - _patch_port->path().chop_start("/").c_str(), JACK_DEFAULT_MIDI_TYPE, + ingen_jack_port_name(_patch_port->path()).c_str(), + JACK_DEFAULT_MIDI_TYPE, (_patch_port->is_input()) ? JackPortIsInput : JackPortIsOutput, 0); @@ -88,6 +90,13 @@ JackMidiPort::destroy() } +void +JackMidiPort::move(const Raul::Path& path) +{ + jack_port_set_name(_jack_port, ingen_jack_port_name(path).c_str()); +} + + /** Prepare input for a block before a cycle is run, in the audio thread. * * This is simple since Jack MIDI is in-band with audio. diff --git a/src/engine/JackMidiDriver.hpp b/src/engine/JackMidiDriver.hpp index db38d68a..68c8182a 100644 --- a/src/engine/JackMidiDriver.hpp +++ b/src/engine/JackMidiDriver.hpp @@ -47,7 +47,7 @@ public: void pre_process(ProcessContext& context); void post_process(ProcessContext& context); - void set_name(const std::string& name) { jack_port_set_name(_jack_port, name.c_str()); }; + void move(const Raul::Path& path); private: JackMidiDriver* _driver; diff --git a/src/engine/events/Move.cpp b/src/engine/events/Move.cpp index eb250dab..d386ce44 100644 --- a/src/engine/events/Move.cpp +++ b/src/engine/events/Move.cpp @@ -112,7 +112,7 @@ Move::execute(ProcessContext& context) driver_port = _engine.midi_driver()->driver_port(_new_path); if (driver_port) - driver_port->set_name(_new_path.str()); + driver_port->move(_new_path); } } diff --git a/src/engine/util.hpp b/src/engine/util.hpp index 01eecd27..945e5101 100644 --- a/src/engine/util.hpp +++ b/src/engine/util.hpp @@ -19,6 +19,7 @@ #define UTIL_HPP #include "ingen-config.h" +#include "raul/Path.hpp" #include <iostream> #include <cstdlib> @@ -73,6 +74,12 @@ set_denormal_flags() #endif } +static inline std::string +ingen_jack_port_name(const Raul::Path& path) +{ + return path.chop_start("/"); +} + } // namespace Ingen #endif // UTIL_HPP |