aboutsummaryrefslogtreecommitdiffstats
path: root/libDRCdec/src/FDK_drcDecLib.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libDRCdec/src/FDK_drcDecLib.cpp')
-rw-r--r--libDRCdec/src/FDK_drcDecLib.cpp160
1 files changed, 93 insertions, 67 deletions
diff --git a/libDRCdec/src/FDK_drcDecLib.cpp b/libDRCdec/src/FDK_drcDecLib.cpp
index 8f3faa0..4f8ebc7 100644
--- a/libDRCdec/src/FDK_drcDecLib.cpp
+++ b/libDRCdec/src/FDK_drcDecLib.cpp
@@ -336,7 +336,13 @@ FDK_drcDec_Init(HANDLE_DRC_DECODER hDrcDec, const int frameSize,
}
if (hDrcDec->functionalRange & DRC_DEC_GAIN) {
- dErr = drcDec_GainDecoder_Init(hDrcDec->hGainDec, frameSize, sampleRate);
+ dErr = drcDec_GainDecoder_SetParam(hDrcDec->hGainDec, GAIN_DEC_FRAME_SIZE,
+ frameSize);
+ if (dErr) return DRC_DEC_NOT_OK;
+ dErr = drcDec_GainDecoder_SetParam(hDrcDec->hGainDec, GAIN_DEC_SAMPLE_RATE,
+ sampleRate);
+ if (dErr) return DRC_DEC_NOT_OK;
+ dErr = drcDec_GainDecoder_Init(hDrcDec->hGainDec);
if (dErr) return DRC_DEC_NOT_OK;
}
@@ -377,79 +383,99 @@ DRC_DEC_ERROR
FDK_drcDec_SetParam(HANDLE_DRC_DECODER hDrcDec,
const DRC_DEC_USERPARAM requestType,
const FIXP_DBL requestValue) {
+ DRC_ERROR dErr = DE_OK;
DRCDEC_SELECTION_PROCESS_RETURN sErr = DRCDEC_SELECTION_PROCESS_NO_ERROR;
+ int invalidParameter = 0;
if (hDrcDec == NULL) return DRC_DEC_NOT_OPENED;
- if (hDrcDec->functionalRange == DRC_DEC_GAIN)
- return DRC_DEC_NOT_OK; /* not supported for DRC_DEC_GAIN. All parameters are
- handed over to selection process lib. */
+ if (hDrcDec->functionalRange & DRC_DEC_GAIN) {
+ switch (requestType) {
+ case DRC_DEC_SAMPLE_RATE:
+ dErr = drcDec_GainDecoder_SetParam(
+ hDrcDec->hGainDec, GAIN_DEC_SAMPLE_RATE, (int)requestValue);
+ if (dErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
+ break;
+ case DRC_DEC_FRAME_SIZE:
+ dErr = drcDec_GainDecoder_SetParam(
+ hDrcDec->hGainDec, GAIN_DEC_FRAME_SIZE, (int)requestValue);
+ if (dErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
+ break;
+ default:
+ invalidParameter |= DRC_DEC_GAIN;
+ }
+ }
- switch (requestType) {
- case DRC_DEC_BOOST:
- sErr = drcDec_SelectionProcess_SetParam(hDrcDec->hSelectionProc,
- SEL_PROC_BOOST, requestValue,
- &(hDrcDec->selProcInputDiff));
- if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
- break;
- case DRC_DEC_COMPRESS:
- sErr = drcDec_SelectionProcess_SetParam(hDrcDec->hSelectionProc,
- SEL_PROC_COMPRESS, requestValue,
- &(hDrcDec->selProcInputDiff));
- if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
- break;
- case DRC_DEC_LOUDNESS_NORMALIZATION_ON:
- sErr = drcDec_SelectionProcess_SetParam(
- hDrcDec->hSelectionProc, SEL_PROC_LOUDNESS_NORMALIZATION_ON,
- requestValue, &(hDrcDec->selProcInputDiff));
- if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
- break;
- case DRC_DEC_TARGET_LOUDNESS:
- sErr = drcDec_SelectionProcess_SetParam(
- hDrcDec->hSelectionProc, SEL_PROC_TARGET_LOUDNESS, requestValue,
- &(hDrcDec->selProcInputDiff));
- if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
- break;
- case DRC_DEC_EFFECT_TYPE:
- sErr = drcDec_SelectionProcess_SetParam(
- hDrcDec->hSelectionProc, SEL_PROC_EFFECT_TYPE, requestValue,
- &(hDrcDec->selProcInputDiff));
- if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
- break;
- case DRC_DEC_DOWNMIX_ID:
- sErr = drcDec_SelectionProcess_SetParam(hDrcDec->hSelectionProc,
- SEL_PROC_DOWNMIX_ID, requestValue,
- &(hDrcDec->selProcInputDiff));
- if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
- break;
- case DRC_DEC_TARGET_CHANNEL_COUNT_REQUESTED:
- sErr = drcDec_SelectionProcess_SetParam(
- hDrcDec->hSelectionProc, SEL_PROC_TARGET_CHANNEL_COUNT, requestValue,
- &(hDrcDec->selProcInputDiff));
- if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
- break;
- case DRC_DEC_BASE_CHANNEL_COUNT:
- sErr = drcDec_SelectionProcess_SetParam(
- hDrcDec->hSelectionProc, SEL_PROC_BASE_CHANNEL_COUNT, requestValue,
- &(hDrcDec->selProcInputDiff));
- if (sErr) return DRC_DEC_NOT_OK;
- break;
- case DRC_DEC_LOUDNESS_MEASUREMENT_METHOD:
- sErr = drcDec_SelectionProcess_SetParam(
- hDrcDec->hSelectionProc, SEL_PROC_LOUDNESS_MEASUREMENT_METHOD,
- requestValue, &(hDrcDec->selProcInputDiff));
- if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
- break;
- case DRC_DEC_ALBUM_MODE:
- sErr = drcDec_SelectionProcess_SetParam(hDrcDec->hSelectionProc,
- SEL_PROC_ALBUM_MODE, requestValue,
- &(hDrcDec->selProcInputDiff));
- if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
- break;
- default:
- return DRC_DEC_INVALID_PARAM;
+ if (hDrcDec->functionalRange & DRC_DEC_SELECTION) {
+ switch (requestType) {
+ case DRC_DEC_BOOST:
+ sErr = drcDec_SelectionProcess_SetParam(hDrcDec->hSelectionProc,
+ SEL_PROC_BOOST, requestValue,
+ &(hDrcDec->selProcInputDiff));
+ if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
+ break;
+ case DRC_DEC_COMPRESS:
+ sErr = drcDec_SelectionProcess_SetParam(hDrcDec->hSelectionProc,
+ SEL_PROC_COMPRESS, requestValue,
+ &(hDrcDec->selProcInputDiff));
+ if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
+ break;
+ case DRC_DEC_LOUDNESS_NORMALIZATION_ON:
+ sErr = drcDec_SelectionProcess_SetParam(
+ hDrcDec->hSelectionProc, SEL_PROC_LOUDNESS_NORMALIZATION_ON,
+ requestValue, &(hDrcDec->selProcInputDiff));
+ if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
+ break;
+ case DRC_DEC_TARGET_LOUDNESS:
+ sErr = drcDec_SelectionProcess_SetParam(
+ hDrcDec->hSelectionProc, SEL_PROC_TARGET_LOUDNESS, requestValue,
+ &(hDrcDec->selProcInputDiff));
+ if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
+ break;
+ case DRC_DEC_EFFECT_TYPE:
+ sErr = drcDec_SelectionProcess_SetParam(
+ hDrcDec->hSelectionProc, SEL_PROC_EFFECT_TYPE, requestValue,
+ &(hDrcDec->selProcInputDiff));
+ if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
+ break;
+ case DRC_DEC_DOWNMIX_ID:
+ sErr = drcDec_SelectionProcess_SetParam(
+ hDrcDec->hSelectionProc, SEL_PROC_DOWNMIX_ID, requestValue,
+ &(hDrcDec->selProcInputDiff));
+ if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
+ break;
+ case DRC_DEC_TARGET_CHANNEL_COUNT_REQUESTED:
+ sErr = drcDec_SelectionProcess_SetParam(
+ hDrcDec->hSelectionProc, SEL_PROC_TARGET_CHANNEL_COUNT,
+ requestValue, &(hDrcDec->selProcInputDiff));
+ if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
+ break;
+ case DRC_DEC_BASE_CHANNEL_COUNT:
+ sErr = drcDec_SelectionProcess_SetParam(
+ hDrcDec->hSelectionProc, SEL_PROC_BASE_CHANNEL_COUNT, requestValue,
+ &(hDrcDec->selProcInputDiff));
+ if (sErr) return DRC_DEC_NOT_OK;
+ break;
+ case DRC_DEC_LOUDNESS_MEASUREMENT_METHOD:
+ sErr = drcDec_SelectionProcess_SetParam(
+ hDrcDec->hSelectionProc, SEL_PROC_LOUDNESS_MEASUREMENT_METHOD,
+ requestValue, &(hDrcDec->selProcInputDiff));
+ if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
+ break;
+ case DRC_DEC_ALBUM_MODE:
+ sErr = drcDec_SelectionProcess_SetParam(
+ hDrcDec->hSelectionProc, SEL_PROC_ALBUM_MODE, requestValue,
+ &(hDrcDec->selProcInputDiff));
+ if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE;
+ break;
+ default:
+ invalidParameter |= DRC_DEC_SELECTION;
+ }
}
+ if (invalidParameter == hDrcDec->functionalRange)
+ return DRC_DEC_INVALID_PARAM;
+
/* All parameters need a new start of the selection process */
startSelectionProcess(hDrcDec);