From 355bf8dbe8852c1bf6e90c372a00787ddb6ce184 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sat, 16 Jan 2010 19:24:09 -0600 Subject: [PATCH] Mixer: Fix plugin loading chicken/egg problem. --- Mixer/Plugin_Module.C | 9 ++++----- nonlib/JACK/Client.C | 4 ++++ nonlib/JACK/Client.H | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Mixer/Plugin_Module.C b/Mixer/Plugin_Module.C index e1b3e9c..3162283 100644 --- a/Mixer/Plugin_Module.C +++ b/Mixer/Plugin_Module.C @@ -38,7 +38,6 @@ #include #include "Engine/Engine.H" -#include "Chain.H" @@ -332,7 +331,7 @@ Plugin_Module::plugin_instances ( unsigned int n ) DMESSAGE( "Instantiating plugin..." ); - if ( ! (h = _idata->descriptor->instantiate( _idata->descriptor, chain()->engine()->sample_rate() ) ) ) + if ( ! (h = _idata->descriptor->instantiate( _idata->descriptor, Engine::sample_rate() ) ) ) { WARNING( "Failed to instantiate plugin" ); return false; @@ -458,7 +457,7 @@ Plugin_Module::load ( unsigned long id ) Min=_idata->descriptor->PortRangeHints[Port].LowerBound; if (LADSPA_IS_HINT_SAMPLE_RATE(HintDesc)) { - Min*=chain()->engine()->sample_rate(); + Min*=Engine::sample_rate(); } } if (LADSPA_IS_HINT_BOUNDED_ABOVE(HintDesc)) @@ -466,7 +465,7 @@ Plugin_Module::load ( unsigned long id ) Max=_idata->descriptor->PortRangeHints[Port].UpperBound; if (LADSPA_IS_HINT_SAMPLE_RATE(HintDesc)) { - Max*=chain()->engine()->sample_rate(); + Max*=Engine::sample_rate(); } } @@ -534,7 +533,7 @@ Plugin_Module::load ( unsigned long id ) } } if (LADSPA_IS_HINT_SAMPLE_RATE(HintDesc)) { - Default *= chain()->engine()->sample_rate(); + Default *= Engine::sample_rate(); } if (LADSPA_IS_HINT_INTEGER(HintDesc)) { if ( p.hints.ranged && diff --git a/nonlib/JACK/Client.C b/nonlib/JACK/Client.C index a45d26d..c9de7a9 100644 --- a/nonlib/JACK/Client.C +++ b/nonlib/JACK/Client.C @@ -24,9 +24,13 @@ + + namespace JACK { + nframes_t Client::_sample_rate = 0; + Client::Client ( ) { _freewheeling = false; diff --git a/nonlib/JACK/Client.H b/nonlib/JACK/Client.H index 5369bff..e9bf51f 100644 --- a/nonlib/JACK/Client.H +++ b/nonlib/JACK/Client.H @@ -36,7 +36,7 @@ namespace JACK jack_client_t *_client; - nframes_t _sample_rate; + static nframes_t _sample_rate; volatile int _xruns; volatile bool _freewheeling; volatile bool _zombified; @@ -88,7 +88,7 @@ namespace JACK nframes_t nframes ( void ) const { return jack_get_buffer_size( _client ); } float frame_rate ( void ) const { return jack_get_sample_rate( _client ); } - nframes_t sample_rate ( void ) const { return _sample_rate; } + static nframes_t sample_rate ( void ) { return _sample_rate; } int xruns ( void ) const { return _xruns; }; bool freewheeling ( void ) const { return _freewheeling; } void freewheeling ( bool yes );