• Home
  • Raw
  • Download

Lines Matching refs:limiter

115   TDLimiterPtr limiter = NULL;  in pcmLimiter_Create()  local
125 limiter = (TDLimiterPtr)FDKcalloc(1, sizeof(struct TDLimiter)); in pcmLimiter_Create()
126 if (!limiter) return NULL; in pcmLimiter_Create()
129 limiter->maxBuf = (FIXP_DBL*)FDKcalloc(attack + 1, sizeof(FIXP_DBL)); in pcmLimiter_Create()
130 limiter->delayBuf = in pcmLimiter_Create()
133 if (!limiter->maxBuf || !limiter->delayBuf) { in pcmLimiter_Create()
134 pcmLimiter_Destroy(limiter); in pcmLimiter_Create()
149 limiter->attackMs = maxAttackMs; in pcmLimiter_Create()
150 limiter->maxAttackMs = maxAttackMs; in pcmLimiter_Create()
151 limiter->releaseMs = releaseMs; in pcmLimiter_Create()
152 limiter->attack = attack; in pcmLimiter_Create()
153 limiter->attackConst = attackConst; in pcmLimiter_Create()
154 limiter->releaseConst = releaseConst; in pcmLimiter_Create()
155 limiter->threshold = threshold >> TDL_GAIN_SCALING; in pcmLimiter_Create()
156 limiter->channels = maxChannels; in pcmLimiter_Create()
157 limiter->maxChannels = maxChannels; in pcmLimiter_Create()
158 limiter->sampleRate = maxSampleRate; in pcmLimiter_Create()
159 limiter->maxSampleRate = maxSampleRate; in pcmLimiter_Create()
161 pcmLimiter_Reset(limiter); in pcmLimiter_Create()
163 return limiter; in pcmLimiter_Create()
167 TDLIMITER_ERROR pcmLimiter_Apply(TDLimiterPtr limiter, PCM_LIM* samplesIn, in pcmLimiter_Apply() argument
181 if (limiter == NULL) return TDLIMIT_INVALID_HANDLE; in pcmLimiter_Apply()
184 unsigned int channels = limiter->channels; in pcmLimiter_Apply()
185 unsigned int attack = limiter->attack; in pcmLimiter_Apply()
186 FIXP_DBL attackConst = limiter->attackConst; in pcmLimiter_Apply()
187 FIXP_DBL releaseConst = limiter->releaseConst; in pcmLimiter_Apply()
188 FIXP_DBL threshold = limiter->threshold; in pcmLimiter_Apply()
190 FIXP_DBL max = limiter->max; in pcmLimiter_Apply()
191 FIXP_DBL* maxBuf = limiter->maxBuf; in pcmLimiter_Apply()
192 unsigned int maxBufIdx = limiter->maxBufIdx; in pcmLimiter_Apply()
193 FIXP_DBL cor = limiter->cor; in pcmLimiter_Apply()
194 FIXP_DBL* delayBuf = limiter->delayBuf; in pcmLimiter_Apply()
195 unsigned int delayBufIdx = limiter->delayBufIdx; in pcmLimiter_Apply()
197 FIXP_DBL smoothState0 = limiter->smoothState0; in pcmLimiter_Apply()
198 FIXP_DBL additionalGainSmoothState = limiter->additionalGainFilterState; in pcmLimiter_Apply()
199 FIXP_DBL additionalGainSmoothState1 = limiter->additionalGainFilterState1; in pcmLimiter_Apply()
213 additionalGainUnfiltered = limiter->additionalGainPrev; in pcmLimiter_Apply()
351 limiter->max = max; in pcmLimiter_Apply()
352 limiter->maxBufIdx = maxBufIdx; in pcmLimiter_Apply()
353 limiter->cor = cor; in pcmLimiter_Apply()
354 limiter->delayBufIdx = delayBufIdx; in pcmLimiter_Apply()
356 limiter->smoothState0 = smoothState0; in pcmLimiter_Apply()
357 limiter->additionalGainFilterState = additionalGainSmoothState; in pcmLimiter_Apply()
358 limiter->additionalGainFilterState1 = additionalGainSmoothState1; in pcmLimiter_Apply()
360 limiter->minGain = minGain; in pcmLimiter_Apply()
362 limiter->additionalGainPrev = pGain[0]; in pcmLimiter_Apply()
369 TDLIMITER_ERROR pcmLimiter_SetThreshold(TDLimiterPtr limiter, in pcmLimiter_SetThreshold() argument
371 if (limiter == NULL) return TDLIMIT_INVALID_HANDLE; in pcmLimiter_SetThreshold()
373 limiter->threshold = threshold >> TDL_GAIN_SCALING; in pcmLimiter_SetThreshold()
379 TDLIMITER_ERROR pcmLimiter_Reset(TDLimiterPtr limiter) { in pcmLimiter_Reset() argument
380 if (limiter != NULL) { in pcmLimiter_Reset()
381 limiter->maxBufIdx = 0; in pcmLimiter_Reset()
382 limiter->delayBufIdx = 0; in pcmLimiter_Reset()
383 limiter->max = (FIXP_DBL)0; in pcmLimiter_Reset()
384 limiter->cor = FL2FXCONST_DBL(1.0f / (1 << 1)); in pcmLimiter_Reset()
385 limiter->smoothState0 = FL2FXCONST_DBL(1.0f / (1 << 1)); in pcmLimiter_Reset()
386 limiter->minGain = FL2FXCONST_DBL(1.0f / (1 << 1)); in pcmLimiter_Reset()
388 limiter->additionalGainPrev = in pcmLimiter_Reset()
390 limiter->additionalGainFilterState = in pcmLimiter_Reset()
392 limiter->additionalGainFilterState1 = in pcmLimiter_Reset()
395 FDKmemset(limiter->maxBuf, 0, (limiter->attack + 1) * sizeof(FIXP_DBL)); in pcmLimiter_Reset()
396 FDKmemset(limiter->delayBuf, 0, in pcmLimiter_Reset()
397 limiter->attack * limiter->channels * sizeof(FIXP_DBL)); in pcmLimiter_Reset()
406 TDLIMITER_ERROR pcmLimiter_Destroy(TDLimiterPtr limiter) { in pcmLimiter_Destroy() argument
407 if (limiter != NULL) { in pcmLimiter_Destroy()
408 FDKfree(limiter->maxBuf); in pcmLimiter_Destroy()
409 FDKfree(limiter->delayBuf); in pcmLimiter_Destroy()
411 FDKfree(limiter); in pcmLimiter_Destroy()
419 unsigned int pcmLimiter_GetDelay(TDLimiterPtr limiter) { in pcmLimiter_GetDelay() argument
420 FDK_ASSERT(limiter != NULL); in pcmLimiter_GetDelay()
421 return limiter->attack; in pcmLimiter_GetDelay()
425 INT pcmLimiter_GetMaxGainReduction(TDLimiterPtr limiter) { in pcmLimiter_GetMaxGainReduction() argument
431 FDK_ASSERT(limiter != NULL); in pcmLimiter_GetMaxGainReduction()
433 loggain = fLog2(limiter->minGain, 1, &e_ans); in pcmLimiter_GetMaxGainReduction()
441 TDLIMITER_ERROR pcmLimiter_SetNChannels(TDLimiterPtr limiter, in pcmLimiter_SetNChannels() argument
443 if (limiter == NULL) return TDLIMIT_INVALID_HANDLE; in pcmLimiter_SetNChannels()
445 if (nChannels > limiter->maxChannels) return TDLIMIT_INVALID_PARAMETER; in pcmLimiter_SetNChannels()
447 limiter->channels = nChannels; in pcmLimiter_SetNChannels()
454 TDLIMITER_ERROR pcmLimiter_SetSampleRate(TDLimiterPtr limiter, in pcmLimiter_SetSampleRate() argument
460 if (limiter == NULL) return TDLIMIT_INVALID_HANDLE; in pcmLimiter_SetSampleRate()
462 if (sampleRate > limiter->maxSampleRate) return TDLIMIT_INVALID_PARAMETER; in pcmLimiter_SetSampleRate()
465 attack = (unsigned int)(limiter->attackMs * sampleRate / 1000); in pcmLimiter_SetSampleRate()
466 release = (unsigned int)(limiter->releaseMs * sampleRate / 1000); in pcmLimiter_SetSampleRate()
478 limiter->attack = attack; in pcmLimiter_SetSampleRate()
479 limiter->attackConst = attackConst; in pcmLimiter_SetSampleRate()
480 limiter->releaseConst = releaseConst; in pcmLimiter_SetSampleRate()
481 limiter->sampleRate = sampleRate; in pcmLimiter_SetSampleRate()
490 TDLIMITER_ERROR pcmLimiter_SetAttack(TDLimiterPtr limiter, in pcmLimiter_SetAttack() argument
496 if (limiter == NULL) return TDLIMIT_INVALID_HANDLE; in pcmLimiter_SetAttack()
498 if (attackMs > limiter->maxAttackMs) return TDLIMIT_INVALID_PARAMETER; in pcmLimiter_SetAttack()
501 attack = (unsigned int)(attackMs * limiter->sampleRate / 1000); in pcmLimiter_SetAttack()
508 limiter->attack = attack; in pcmLimiter_SetAttack()
509 limiter->attackConst = attackConst; in pcmLimiter_SetAttack()
510 limiter->attackMs = attackMs; in pcmLimiter_SetAttack()
516 TDLIMITER_ERROR pcmLimiter_SetRelease(TDLimiterPtr limiter, in pcmLimiter_SetRelease() argument
522 if (limiter == NULL) return TDLIMIT_INVALID_HANDLE; in pcmLimiter_SetRelease()
525 release = (unsigned int)(releaseMs * limiter->sampleRate / 1000); in pcmLimiter_SetRelease()
532 limiter->releaseConst = releaseConst; in pcmLimiter_SetRelease()
533 limiter->releaseMs = releaseMs; in pcmLimiter_SetRelease()