Merge branch 'filters_ranges' into 'master'

plugins/filters: add some missing option ranges

See merge request videolan/vlc!1235
This commit is contained in:
Lyndon Brown 2024-04-28 07:11:03 +00:00
commit 376d82c14a
6 changed files with 22 additions and 30 deletions

View File

@ -26,6 +26,7 @@
#endif
#include <math.h>
#include <float.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
@ -77,14 +78,17 @@ vlc_module_begin ()
set_help( N_("Add a delay effect to the sound") )
set_subcategory( SUBCAT_AUDIO_AFILTER )
add_shortcut( "delay" )
add_float( "delay-time", 20, N_("Delay time"),
add_float( "delay-time", 20.0, N_("Delay time"),
N_("Time in milliseconds of the average delay. Note average") )
add_float( "sweep-depth", 6, N_("Sweep Depth"),
change_float_range( 0.0, FLT_MAX )
add_float( "sweep-depth", 6.0, N_("Sweep Depth"),
N_("Time in milliseconds of the maximum sweep depth. Thus, the sweep "
"range will be delay-time +/- sweep-depth.") )
add_float( "sweep-rate", 6, N_("Sweep Rate"),
change_float_range( 0.0, FLT_MAX )
add_float( "sweep-rate", 6.0, N_("Sweep Rate"),
N_("Rate of change of sweep depth in milliseconds shift per second "
"of play") )
change_float_range( 0.0, FLT_MAX )
add_float_with_range( "feedback-gain", 0.5, -0.9, 0.9,
N_("Feedback gain"), N_("Gain on Feedback loop") )
add_float_with_range( "wet-mix", 0.4, -0.999, 0.999,
@ -130,27 +134,13 @@ static int Open( vlc_object_t *p_this )
var_AddCallback( p_this, "dry-mix", paramCallback, p_sys );
var_AddCallback( p_this, "wet-mix", paramCallback, p_sys );
if( p_sys->f_delayTime < 0.f )
{
msg_Err( p_filter, "Delay Time is invalid" );
free(p_sys);
return VLC_EGENERIC;
}
if( p_sys->f_sweepDepth > p_sys->f_delayTime || p_sys->f_sweepDepth < 0.f )
if( p_sys->f_sweepDepth > p_sys->f_delayTime )
{
msg_Err( p_filter, "Sweep Depth is invalid" );
free( p_sys );
return VLC_EGENERIC;
}
if( p_sys->f_sweepRate < 0.f )
{
msg_Err( p_filter, "Sweep Rate is invalid" );
free( p_sys );
return VLC_EGENERIC;
}
/* Max delay = delay + depth. Min = delay - depth */
p_sys->i_bufferLength = p_sys->i_channels * ( (int)( ( p_sys->f_delayTime
+ p_sys->f_sweepDepth ) * p_filter->fmt_in.audio.i_rate/1000 ) + 1 );

View File

@ -92,6 +92,7 @@ vlc_module_begin ()
VLC_BANDS_LONGTEXT )
add_float( "equalizer-preamp", 12.0f, PREAMP_TEXT,
PREAMP_LONGTEXT )
change_float_range( -20.0f, 20.0f )
set_callback( Open )
add_shortcut( "equalizer" )
vlc_module_end ()
@ -518,14 +519,8 @@ static int PreampCallback( vlc_object_t *p_this, char const *psz_cmd,
{
VLC_UNUSED(p_this); VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval);
filter_sys_t *p_sys = p_data;
float preamp;
if( newval.f_float < -20.f )
preamp = .1f;
else if( newval.f_float < 20.f )
preamp = powf( 10.f, newval.f_float / 20.f );
else
preamp = 10.f;
float preamp = powf( 10.f, newval.f_float / 20.f );
vlc_mutex_lock( &p_sys->lock );
p_sys->f_gamp = preamp;

View File

@ -36,6 +36,8 @@
#endif
#include <math.h>
#include <float.h>
#include <limits.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
@ -70,8 +72,7 @@ typedef struct
#define LEVEL_TEXT N_("Maximal volume level" )
#define LEVEL_LONGTEXT N_("If the average power over the last N buffers " \
"is higher than this value, the volume will be normalized. " \
"This value is a positive floating point number. A value " \
"between 0.5 and 10 seems sensible." )
"A value between 0.5 and 10.0 seems sensible." )
vlc_module_begin ()
set_description( N_("Volume normalizer") )
@ -79,8 +80,10 @@ vlc_module_begin ()
set_subcategory( SUBCAT_AUDIO_AFILTER )
add_shortcut( "volnorm" )
add_integer( "norm-buff-size", 20 ,BUFF_TEXT, BUFF_LONGTEXT )
change_integer_range( 0, INT_MAX )
add_float( "norm-max-level", 2.0, LEVEL_TEXT,
LEVEL_LONGTEXT )
change_float_range( 0.01, FLT_MAX )
set_capability( "audio filter", 0 )
set_callback( Open )
vlc_module_end ()
@ -104,8 +107,6 @@ static int Open( vlc_object_t *p_this )
p_sys->f_max = var_CreateGetFloat( vlc_object_parent(p_filter),
"norm-max-level" );
if( p_sys->f_max <= 0 ) p_sys->f_max = 0.01;
/* We need to store (nb_buffers+1)*nb_channels floats */
p_sys->p_last = calloc( i_channels * (p_sys->i_nb + 2), sizeof(float) );
if( !p_sys->p_last )

View File

@ -28,6 +28,8 @@
# include "config.h"
#endif
#include <limits.h>
#include <vlc_common.h>
#include <vlc_configuration.h>
#include <vlc_plugin.h>
@ -79,6 +81,7 @@ vlc_module_begin ()
set_section( N_("Benchmarking"), NULL )
add_integer( CFG_PREFIX "loops", 1000, LOOPS_TEXT,
LOOPS_LONGTEXT )
change_integer_range( 0, INT_MAX )
add_integer_with_range( CFG_PREFIX "alpha", 128, 0, 255, ALPHA_TEXT,
ALPHA_LONGTEXT )

View File

@ -71,7 +71,8 @@ vlc_module_begin ()
set_shortname( N_( "Rotate" ))
set_subcategory( SUBCAT_VIDEO_VFILTER )
add_float( FILTER_PREFIX "angle", 30., ANGLE_TEXT, ANGLE_LONGTEXT )
add_float( FILTER_PREFIX "angle", 30.0, ANGLE_TEXT, ANGLE_LONGTEXT )
change_float_range( 0.0, 360.0 )
add_bool( FILTER_PREFIX "use-motion", false, MOTION_TEXT,
MOTION_LONGTEXT )

View File

@ -102,8 +102,10 @@ vlc_module_begin ()
FORMAT_TEXT, FORMAT_LONGTEXT )
add_integer( CFG_PREFIX "width", -1,
WIDTH_TEXT, WIDTH_LONGTEXT )
change_integer_range( -1, INT_MAX )
add_integer( CFG_PREFIX "height", -1,
HEIGHT_TEXT, HEIGHT_LONGTEXT )
change_integer_range( -1, INT_MAX )
add_string( CFG_PREFIX "prefix", "scene",
PREFIX_TEXT, PREFIX_LONGTEXT )
add_string( CFG_PREFIX "path", NULL,