]> 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:06 +0000 (20:33 +0000)
commitecd1a727e8c4af9eda7097f299c85d0a646f7ab1
treee2a6d8740f57b15dc4d585da51917a2ae7fdbec1
parentc2444b188a58e7410218c9585bc8c01cb1fdcdb0
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