]> 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)
committerAsterisk Development Team <asteriskteam@digium.com>
Thu, 1 May 2025 12:41:16 +0000 (12:41 +0000)
commit6a7038e2c5d201b857e7b0da05bbb4f55a327e92
treeedb0fde43e9c64a8bb24aa51b326154463c3fc9e
parent870f59e28d3930cc30fffe01bc3e660df3d9eaa7
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
(cherry picked from commit ca8adc245422b26c489456b82c6b3a9fdcf74e4d)
include/asterisk/audiohook.h
main/audiohook.c