]> git.ipfire.org Git - thirdparty/asterisk.git/commit
audiohook.c: Add ability to adjust volume with float
authormkmer <mike.j.kasper@gmail.com>
Tue, 18 Mar 2025 11:51:06 +0000 (07:51 -0400)
committermkmer <mike.j.kasper@gmail.com>
Mon, 31 Mar 2025 20:33:07 +0000 (20:33 +0000)
commitca8adc245422b26c489456b82c6b3a9fdcf74e4d
treeb87637a6d459b3d8c1d46d6c66516d0e7a7f83d2
parentea657ec7c7f14995e346a9f263627d89754aac52
audiohook.c: Add ability to adjust volume with float

Add the capability to audiohook for float type volume adjustments.  This allows for adjustments to volume smaller than 6dB.  With INT adjustments, the first step is 2 which converts to ~6dB (or 1/2 volume / double volume depending on adjustment sign). 3dB is a typical adjustment level which can now be accommodated with an adjustment value of 1.41.

This is accomplished by the following:
  Convert internal variables to type float.
  Always use ast_frame_adjust_volume_float() for adjustments.
  Cast int to float in original functions ast_audiohook_volume_set(), and ast_volume_adjust().
  Cast float to int in ast_audiohook_volume_get()
  Add functions ast_audiohook_volume_get_float, ast_audiohook_volume_set_float, and ast_audiohook_volume_adjust_float.

This update maintains 100% backward compatibility.

Resolves: #1171
include/asterisk/audiohook.h
main/audiohook.c