mirror of
https://github.com/asterisk/asterisk.git
synced 2025-12-02 11:11:55 +00:00
func_volume: Accept decimal number as argument
Allow voice volume to be multiplied or divided by a floating point number. ASTERISK-28813 Change-Id: I5b42b890ec4e1f6b0b3400cb44ff16522b021c8c
This commit is contained in:
committed by
Friendly Automation
parent
2b80e5f5da
commit
de66713fd5
@@ -375,11 +375,35 @@ static force_inline void ast_slinear_saturated_multiply(short *input, short *val
|
||||
*input = (short) res;
|
||||
}
|
||||
|
||||
static force_inline void ast_slinear_saturated_multiply_float(short *input, float *value)
|
||||
{
|
||||
float res;
|
||||
|
||||
res = (float) *input * *value;
|
||||
if (res > 32767)
|
||||
*input = 32767;
|
||||
else if (res < -32768)
|
||||
*input = -32768;
|
||||
else
|
||||
*input = (short) res;
|
||||
}
|
||||
|
||||
static force_inline void ast_slinear_saturated_divide(short *input, short *value)
|
||||
{
|
||||
*input /= *value;
|
||||
}
|
||||
|
||||
static force_inline void ast_slinear_saturated_divide_float(short *input, float *value)
|
||||
{
|
||||
float res = (float) *input / *value;
|
||||
if (res > 32767)
|
||||
*input = 32767;
|
||||
else if (res < -32768)
|
||||
*input = -32768;
|
||||
else
|
||||
*input = (short) res;
|
||||
}
|
||||
|
||||
#ifdef localtime_r
|
||||
#undef localtime_r
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user