calculate smoothing value depending on samplerate
Because smoothing "speed" distinguish between two sample rates, we need to calculate the right smoothing value for the used sample rate on runtime. This commit changes this. The SMOOTHING_CONST in config.hxx can still be used to configurate the general speed for smoothing.main
parent
701e9dc24b
commit
21e53c391d
24
src/jack.cxx
24
src/jack.cxx
|
@ -78,12 +78,16 @@ Jack::Jack( std::string name ) :
|
|||
client( jack_client_open ( name.c_str(), JackNullOption, 0, 0 ) ),
|
||||
state( new State() ),
|
||||
controllerUpdater( new ControllerUpdater() ),
|
||||
clientActive(false)
|
||||
clientActive(false),
|
||||
smoothing_value(SMOOTHING_CONST * (44100.f / samplerate))
|
||||
{
|
||||
jack = this;
|
||||
lastnframes=0;
|
||||
samplerate = jack_get_sample_rate( client );
|
||||
|
||||
// calculate smoothing value for current sample rate
|
||||
//smoothing_value = SMOOTHING_CONST * (44100.f / samplerate);
|
||||
|
||||
// construct Observer classes here, not in the initializer list as the Jack*
|
||||
// will be 0x0 until then.
|
||||
timeManager = new TimeManager(),
|
||||
|
@ -544,15 +548,15 @@ void Jack::processFrames(int nframes)
|
|||
/// mix input, reverb & post-sidechain in
|
||||
for(unsigned int i = 0; i < nframes; i++) {
|
||||
// compute *lags für smoothing
|
||||
inputToMixVolLag += SMOOTHING_CONST * (inputToMixVol - inputToMixVolLag);
|
||||
inputToSendVolLag += SMOOTHING_CONST * (inputToSendVol - inputToSendVolLag);
|
||||
inputToXSideVolLag += SMOOTHING_CONST * (inputToXSideVol - inputToXSideVolLag);
|
||||
returnVolLag += SMOOTHING_CONST * (returnVol - returnVolLag);
|
||||
inputVolLag += SMOOTHING_CONST * (inputVol - inputVolLag);
|
||||
inputToMixVolLag += smoothing_value * (inputToMixVol - inputToMixVolLag);
|
||||
inputToSendVolLag += smoothing_value * (inputToSendVol - inputToSendVolLag);
|
||||
inputToXSideVolLag += smoothing_value * (inputToXSideVol - inputToXSideVolLag);
|
||||
returnVolLag += smoothing_value * (returnVol - returnVolLag);
|
||||
inputVolLag += smoothing_value * (inputVol - inputVolLag);
|
||||
|
||||
inputToKeyEnableLag += SMOOTHING_CONST * (inputToKeyEnable - inputToKeyEnableLag);
|
||||
inputToMixEnableLag += SMOOTHING_CONST * (inputToMixEnable - inputToMixEnableLag);
|
||||
inputToSendEnableLag += SMOOTHING_CONST * (inputToSendEnable - inputToSendEnableLag);
|
||||
inputToKeyEnableLag += smoothing_value * (inputToKeyEnable - inputToKeyEnableLag);
|
||||
inputToMixEnableLag += smoothing_value * (inputToMixEnable - inputToMixEnableLag);
|
||||
inputToSendEnableLag += smoothing_value * (inputToSendEnable - inputToSendEnableLag);
|
||||
|
||||
float inputL = buffers.audio[Buffers::MASTER_INPUT_L][i] * inputVolLag;
|
||||
float inputR = buffers.audio[Buffers::MASTER_INPUT_R][i] * inputVolLag;
|
||||
|
@ -581,7 +585,7 @@ void Jack::processFrames(int nframes)
|
|||
buffers.audio[Buffers::SIDECHAIN_SIGNAL_R][i] += inputR * inputToXSideVolLag;
|
||||
|
||||
//compute master volume lag;
|
||||
masterVolLag += SMOOTHING_CONST * (masterVol - masterVolLag);
|
||||
masterVolLag += smoothing_value * (masterVol - masterVolLag);
|
||||
/// mixdown returns into master buffers
|
||||
buffers.audio[Buffers::JACK_MASTER_OUT_L][i] = (L + returnL*returnVolLag) * masterVolLag;
|
||||
buffers.audio[Buffers::JACK_MASTER_OUT_R][i] = (R + returnR*returnVolLag) * masterVolLag;
|
||||
|
|
|
@ -136,6 +136,8 @@ public:
|
|||
int bindingActive;
|
||||
|
||||
JackSendReturn *getJackSendReturn(int t);
|
||||
|
||||
const float smoothing_value;
|
||||
private:
|
||||
int lastnframes;
|
||||
jack_client_t* client;
|
||||
|
|
|
@ -53,12 +53,12 @@ void JackSendReturn::process(unsigned int nframes, Buffers *buffers)
|
|||
}
|
||||
|
||||
for(int i=0; i<nframes; i++) {
|
||||
_sendVolLag += SMOOTHING_CONST * (_sendVol - _sendVolLag);
|
||||
_sendVolLag += jack->smoothing_value * (_sendVol - _sendVolLag);
|
||||
|
||||
sendL[i] = _sendVolLag * sendtrackL[i];
|
||||
sendR[i] = _sendVolLag * sendtrackR[i];
|
||||
|
||||
_activeLag += SMOOTHING_CONST * (float(_active) - _activeLag);
|
||||
_activeLag += jack->smoothing_value * (float(_active) - _activeLag);
|
||||
|
||||
rettrackL[i] = retL[i] * _activeLag + sendtrackL[i] * std::fabs(_activeLag - 1);
|
||||
rettrackR[i] = retR[i] * _activeLag + sendtrackR[i] * std::fabs(_activeLag - 1);
|
||||
|
|
|
@ -136,7 +136,7 @@ void TrackOutput::process(unsigned int nframes, Buffers* buffers)
|
|||
int trackoffset = track * NCHANNELS;
|
||||
|
||||
//compute master volume lag;
|
||||
_toMasterLag += SMOOTHING_CONST * (_toMaster - _toMasterLag);
|
||||
_toMasterLag += jack->smoothing_value * (_toMaster - _toMasterLag);
|
||||
|
||||
// get & zero track buffer
|
||||
float* trackBufferL = buffers->audio[Buffers::RETURN_TRACK_0_L + trackoffset];
|
||||
|
@ -178,21 +178,21 @@ void TrackOutput::process(unsigned int nframes, Buffers* buffers)
|
|||
for(unsigned int i = 0; i < nframes; i++) {
|
||||
|
||||
//compute master volume lag;
|
||||
_toMasterLag += SMOOTHING_CONST * (_toMaster - _toMasterLag);
|
||||
_toMasterLag += jack->smoothing_value * (_toMaster - _toMasterLag);
|
||||
|
||||
// compute pan lag:
|
||||
_panLLag += SMOOTHING_CONST * (_panL - _panLLag);
|
||||
_panRLag += SMOOTHING_CONST * (_panR - _panRLag);
|
||||
_panLLag += jack->smoothing_value * (_panL - _panLLag);
|
||||
_panRLag += jack->smoothing_value * (_panR - _panRLag);
|
||||
|
||||
// compute send volume lag:
|
||||
_toSendLag += SMOOTHING_CONST * (_toSend - _toSendLag);
|
||||
_toSendLag += jack->smoothing_value * (_toSend - _toSendLag);
|
||||
|
||||
// compute sidechain signal lag
|
||||
_toPostSidechainLag += SMOOTHING_CONST * (_toPostSidechain - _toPostSidechainLag);
|
||||
_toPostSidechainLag += jack->smoothing_value * (_toPostSidechain - _toPostSidechainLag);
|
||||
|
||||
// compute discrete lag values
|
||||
_toPostfaderActiveLag += SMOOTHING_CONST * (float(_toPostfaderActive) - _toPostfaderActiveLag);
|
||||
_toKeyActiveLag += SMOOTHING_CONST * (float(_toKeyActive) - _toKeyActiveLag);
|
||||
_toPostfaderActiveLag += jack->smoothing_value * (float(_toPostfaderActive) - _toPostfaderActiveLag);
|
||||
_toKeyActiveLag += jack->smoothing_value * (float(_toKeyActive) - _toKeyActiveLag);
|
||||
|
||||
// * master for "post-fader" sends
|
||||
float tmpL = trackBufferL[i];
|
||||
|
|
Loading…
Reference in New Issue