-Caching samplerate locally in Jack

This commit is contained in:
Harry van Haaren 2014-02-08 13:30:38 +00:00
parent 7408d51d33
commit 9a72eb0cf5
2 changed files with 7 additions and 2 deletions

View file

@ -84,6 +84,11 @@ Jack::Jack( std::string name ) :
clientActive(false) clientActive(false)
{ {
jack = this; jack = this;
samplerate = jack_get_sample_rate( client );
LUPPP_NOTE("Samplerate %i", samplerate );
// construct Observer classes here, not in the initializer list as the Jack* // construct Observer classes here, not in the initializer list as the Jack*
// will be 0x0 until then. // will be 0x0 until then.
timeManager = new TimeManager(), timeManager = new TimeManager(),
@ -91,7 +96,6 @@ Jack::Jack( std::string name ) :
logic = new Logic(); logic = new Logic();
gridLogic = new GridLogic(); gridLogic = new GridLogic();
// CAREFUL: setup the size by default: otherwise malloc() is called on push_back // CAREFUL: setup the size by default: otherwise malloc() is called on push_back
midiIO.reserve( CONTROLLERS_PREALLOC ); midiIO.reserve( CONTROLLERS_PREALLOC );
@ -554,7 +558,7 @@ int Jack::getBuffersize()
int Jack::getSamplerate() int Jack::getSamplerate()
{ {
return jack_get_sample_rate( client ); return samplerate;
} }
int Jack::timebase(jack_transport_state_t state, int Jack::timebase(jack_transport_state_t state,

View file

@ -141,6 +141,7 @@ class Jack
// JACK member variables // JACK member variables
bool clientActive; bool clientActive;
int samplerate;
jack_port_t* masterInput; jack_port_t* masterInput;
jack_port_t* masterOutputL; jack_port_t* masterOutputL;