@ -1210,8 +1210,8 @@ int ast_channel_audiohook_count_by_source_running(struct ast_channel *chan, cons
/*! \brief Audiohook volume adjustment structure */
/*! \brief Audiohook volume adjustment structure */
struct audiohook_volume {
struct audiohook_volume {
struct ast_audiohook audiohook ; /*!< Audiohook attached to the channel */
struct ast_audiohook audiohook ; /*!< Audiohook attached to the channel */
in t read_adjustment ; /*!< Value to adjust frames read from the channel by */
floa t read_adjustment ; /*!< Value to adjust frames read from the channel by */
in t write_adjustment ; /*!< Value to adjust frames written to the channel by */
floa t write_adjustment ; /*!< Value to adjust frames written to the channel by */
} ;
} ;
/*! \brief Callback used to destroy the audiohook volume datastore
/*! \brief Callback used to destroy the audiohook volume datastore
@ -1248,7 +1248,7 @@ static int audiohook_volume_callback(struct ast_audiohook *audiohook, struct ast
{
{
struct ast_datastore * datastore = NULL ;
struct ast_datastore * datastore = NULL ;
struct audiohook_volume * audiohook_volume = NULL ;
struct audiohook_volume * audiohook_volume = NULL ;
in t * gain = NULL ;
floa t * gain = NULL ;
/* If the audiohook is shutting down don't even bother */
/* If the audiohook is shutting down don't even bother */
if ( audiohook - > status = = AST_AUDIOHOOK_STATUS_DONE ) {
if ( audiohook - > status = = AST_AUDIOHOOK_STATUS_DONE ) {
@ -1271,7 +1271,7 @@ static int audiohook_volume_callback(struct ast_audiohook *audiohook, struct ast
/* If an adjustment value is present modify the frame */
/* If an adjustment value is present modify the frame */
if ( gain & & * gain ) {
if ( gain & & * gain ) {
ast_frame_adjust_volume ( frame , * gain ) ;
ast_frame_adjust_volume _float ( frame , * gain ) ;
}
}
return 0 ;
return 0 ;
@ -1319,6 +1319,11 @@ static struct audiohook_volume *audiohook_volume_get(struct ast_channel *chan, i
}
}
int ast_audiohook_volume_set ( struct ast_channel * chan , enum ast_audiohook_direction direction , int volume )
int ast_audiohook_volume_set ( struct ast_channel * chan , enum ast_audiohook_direction direction , int volume )
{
return ast_audiohook_volume_adjust_float ( chan , direction , ( float ) volume ) ;
}
int ast_audiohook_volume_set_float ( struct ast_channel * chan , enum ast_audiohook_direction direction , float volume )
{
{
struct audiohook_volume * audiohook_volume = NULL ;
struct audiohook_volume * audiohook_volume = NULL ;
@ -1339,9 +1344,14 @@ int ast_audiohook_volume_set(struct ast_channel *chan, enum ast_audiohook_direct
}
}
int ast_audiohook_volume_get ( struct ast_channel * chan , enum ast_audiohook_direction direction )
int ast_audiohook_volume_get ( struct ast_channel * chan , enum ast_audiohook_direction direction )
{
return ( int ) ast_audiohook_volume_get_float ( chan , direction ) ;
}
float ast_audiohook_volume_get_float ( struct ast_channel * chan , enum ast_audiohook_direction direction )
{
{
struct audiohook_volume * audiohook_volume = NULL ;
struct audiohook_volume * audiohook_volume = NULL ;
int adjustment = 0 ;
floa t adjustment = 0 ;
/* Attempt to find the audiohook volume information, but do not create it as we only want to look at the values */
/* Attempt to find the audiohook volume information, but do not create it as we only want to look at the values */
if ( ! ( audiohook_volume = audiohook_volume_get ( chan , 0 ) ) ) {
if ( ! ( audiohook_volume = audiohook_volume_get ( chan , 0 ) ) ) {
@ -1359,6 +1369,11 @@ int ast_audiohook_volume_get(struct ast_channel *chan, enum ast_audiohook_direct
}
}
int ast_audiohook_volume_adjust ( struct ast_channel * chan , enum ast_audiohook_direction direction , int volume )
int ast_audiohook_volume_adjust ( struct ast_channel * chan , enum ast_audiohook_direction direction , int volume )
{
return ast_audiohook_volume_adjust_float ( chan , direction , ( float ) volume ) ;
}
int ast_audiohook_volume_adjust_float ( struct ast_channel * chan , enum ast_audiohook_direction direction , float volume )
{
{
struct audiohook_volume * audiohook_volume = NULL ;
struct audiohook_volume * audiohook_volume = NULL ;