diff --git a/mixer/src/Controller_Module.C b/mixer/src/Controller_Module.C index e1ca791..788d4af 100644 --- a/mixer/src/Controller_Module.C +++ b/mixer/src/Controller_Module.C @@ -221,7 +221,7 @@ Controller_Module::mode ( Mode m ) char prefix[512]; snprintf( prefix, sizeof(prefix), "CV-%s", p->name() ); - add_aux_audio_input( prefix, 0 ); + add_aux_cv_input( prefix, 0 ); chain()->client()->unlock(); } diff --git a/mixer/src/Module.C b/mixer/src/Module.C index 3b6b558..73ba14d 100644 --- a/mixer/src/Module.C +++ b/mixer/src/Module.C @@ -1270,7 +1270,7 @@ Module::set_latency ( JACK::Port::direction_e dir, nframes_t min, nframes_t max bool -Module::add_aux_port ( bool input, const char *prefix, int i ) +Module::add_aux_port ( bool input, const char *prefix, int i, JACK::Port::type_e type ) { const char *trackname = chain()->strip()->group()->single() ? NULL : chain()->name(); @@ -1278,7 +1278,7 @@ Module::add_aux_port ( bool input, const char *prefix, int i ) char *portname = generate_port_name( prefix, direction, i ); - JACK::Port *po = new JACK::Port( chain()->client(), trackname, portname, direction, JACK::Port::Audio ); + JACK::Port *po = new JACK::Port( chain()->client(), trackname, portname, direction, type ); free(portname); @@ -1319,7 +1319,7 @@ Module::add_aux_port ( bool input, const char *prefix, int i ) bool Module::add_aux_audio_output( const char *prefix, int i ) { - bool r = add_aux_port ( false, prefix, i ); + bool r = add_aux_port ( false, prefix, i , JACK::Port::Audio); if ( r ) mixer->maybe_auto_connect_output( &aux_audio_output.back() ); @@ -1330,7 +1330,13 @@ Module::add_aux_audio_output( const char *prefix, int i ) bool Module::add_aux_audio_input( const char *prefix, int i ) { - return add_aux_port ( true, prefix, i ); + return add_aux_port ( true, prefix, i , JACK::Port::Audio); +} + +bool +Module::add_aux_cv_input( const char *prefix, int i ) +{ + return add_aux_port ( true, prefix, i , JACK::Port::CV); } diff --git a/mixer/src/Module.H b/mixer/src/Module.H index db21d05..4ed9349 100644 --- a/mixer/src/Module.H +++ b/mixer/src/Module.H @@ -499,7 +499,7 @@ protected: virtual void get ( Log_Entry &e ) const; virtual void set ( Log_Entry &e ); - bool add_aux_port ( bool input, const char *prefix, int n ); + bool add_aux_port ( bool input, const char *prefix, int n , JACK::Port::type_e type ); public: nframes_t sample_rate ( void ) const { return Module::_sample_rate; } @@ -513,6 +513,7 @@ public: bool add_aux_audio_output ( const char *prefix, int n ); bool add_aux_audio_input ( const char *prefix, int n ); + bool add_aux_cv_input ( const char *prefix, int n ); static void set_sample_rate ( nframes_t srate ) { _sample_rate = srate; } diff --git a/nonlib/JACK/Client.H b/nonlib/JACK/Client.H index 5954188..cffadc6 100644 --- a/nonlib/JACK/Client.H +++ b/nonlib/JACK/Client.H @@ -21,6 +21,9 @@ #include #include +#ifdef HAVE_JACK_METADATA +# include +#endif #include typedef jack_nframes_t nframes_t; diff --git a/nonlib/JACK/Port.C b/nonlib/JACK/Port.C index b4612c9..d8bc52f 100644 --- a/nonlib/JACK/Port.C +++ b/nonlib/JACK/Port.C @@ -71,6 +71,8 @@ namespace JACK _type = Audio; if ( strstr( type, "MIDI") ) _type = MIDI; + else if ( strstr( type, "CV)") ) + _type = CV; _client->port_added( this ); @@ -190,10 +192,18 @@ namespace JACK DMESSAGE( "Activating port name %s", jackname ); _port = jack_port_register( _client->jack_client(), jackname, - _type == Audio ? JACK_DEFAULT_AUDIO_TYPE : JACK_DEFAULT_MIDI_TYPE, + ( _type == Audio ) || ( _type == CV ) ? JACK_DEFAULT_AUDIO_TYPE : JACK_DEFAULT_MIDI_TYPE, flags, 0 ); +#ifdef HAVE_JACK_METADATA + if ( _type == CV ) + { + jack_uuid_t uuid = jack_port_uuid( _port ); + jack_set_property( _client->jack_client(), uuid, "http://jackaudio.org/metadata/signal-type", "CV", "text/plain" ); + } +#endif + DMESSAGE( "Port = %p", _port ); if ( ! _port ) @@ -266,7 +276,16 @@ namespace JACK Port::deactivate ( void ) { if ( _port ) + { +#ifdef HAVE_JACK_METADATA + if ( _type == CV ) + { + jack_uuid_t uuid = jack_port_uuid(_port); + jack_remove_property(_client->jack_client(), uuid, "http://jackaudio.org/metadata/signal-type"); + } +#endif jack_port_unregister( _client->jack_client(), _port ); + } _port = 0; } diff --git a/nonlib/JACK/Port.H b/nonlib/JACK/Port.H index 27f4ea8..202f77f 100644 --- a/nonlib/JACK/Port.H +++ b/nonlib/JACK/Port.H @@ -44,7 +44,7 @@ namespace JACK bool operator < ( const Port & rhs ) const; enum direction_e { Output, Input }; - enum type_e { Audio, MIDI }; + enum type_e { Audio, MIDI, CV }; static int max_name ( void ); diff --git a/timeline/src/Control_Sequence.C b/timeline/src/Control_Sequence.C index 261927f..9368dfa 100644 --- a/timeline/src/Control_Sequence.C +++ b/timeline/src/Control_Sequence.C @@ -175,7 +175,7 @@ Control_Sequence::update_port_name ( void ) if ( ! _output ) { - _output = new JACK::Port( engine, track()->name(), s, JACK::Port::Output, JACK::Port::Audio ); + _output = new JACK::Port( engine, track()->name(), s, JACK::Port::Output, JACK::Port::CV ); _output->terminal( true ); needs_activation = true; } diff --git a/wscript b/wscript index 716b7bd..f6118c6 100644 --- a/wscript +++ b/wscript @@ -61,6 +61,12 @@ def configure(conf): define_name='HAVE_JACK_PORT_GET_LATENCY_RANGE', fragment='#include \nint main (int argc, char**argv) { jack_port_get_latency_range( (jack_port_t*)0, JackCaptureLatency, (jack_latency_range_t *)0 ); }', mandatory=False); + + conf.check(function_name='jack_get_property', + header_name='jack/metadata.h', + define_name='HAVE_JACK_METADATA', + uselib='JACK', + mandatory=False) conf.check_cfg(package='x11', uselib_store='XLIB',args="--cflags --libs", mandatory=True)