add mono channel option - release

This commit is contained in:
Philippe G
2021-02-06 18:02:33 -08:00
parent b9deead084
commit 369a9cb9bc
7 changed files with 40 additions and 25 deletions

View File

@@ -356,17 +356,34 @@ void _apply_cross(struct buffer *outputbuf, frames_t out_frames, s32_t cross_gai
}
}
#if !WIN
inline
#endif
void _apply_gain(struct buffer *outputbuf, frames_t count, s32_t gainL, s32_t gainR) {
ISAMPLE_T *ptrL = (ISAMPLE_T *)(void *)outputbuf->readp;
ISAMPLE_T *ptrR = (ISAMPLE_T *)(void *)outputbuf->readp + 1;
while (count--) {
*ptrL = gain(gainL, *ptrL);
*ptrR = gain(gainR, *ptrR);
ptrL += 2;
ptrR += 2;
}
if (gainL == FIXED_ONE && gainR == FIXED_ONE) {
return;
} else if (gainL == MONO_MUTED) {
ISAMPLE_T *ptr = (ISAMPLE_T *)(void *)outputbuf->readp + 1;
while (count--) {
*(ptr - 1) = *ptr = gain(gainR, *ptr);
ptr += 2;
}
} else if (gainR == MONO_MUTED) {
ISAMPLE_T *ptr = (ISAMPLE_T *)(void *)outputbuf->readp;
while (count--) {
*(ptr + 1) = *ptr = gain(gainL, *ptr);
ptr += 2;
}
} else {
ISAMPLE_T *ptrL = (ISAMPLE_T *)(void *)outputbuf->readp;
ISAMPLE_T *ptrR = (ISAMPLE_T *)(void *)outputbuf->readp + 1;
while (count--) {
*ptrL = gain(gainL, *ptrL);
*ptrR = gain(gainR, *ptrR);
ptrL += 2; ptrR += 2;
}
}
}