From 82245ba65d5b13a9cf40921affb70872147cf00c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 30 Dec 2009 04:35:09 +0000 Subject: Fix JACK name of top level ports (fix ticket #457). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2319 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/Driver.hpp | 2 +- src/engine/JackAudioDriver.cpp | 10 +++++++++- src/engine/JackAudioDriver.hpp | 2 +- src/engine/JackMidiDriver.cpp | 11 ++++++++++- src/engine/JackMidiDriver.hpp | 2 +- src/engine/events/Move.cpp | 2 +- src/engine/util.hpp | 7 +++++++ 7 files changed, 30 insertions(+), 6 deletions(-) (limited to 'src') 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); @@ -91,6 +92,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) { 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 #include @@ -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 -- cgit v1.2.1