#include <math.h>
#include "fft.h"
+#include "window.h"
#define PEAK_SPEED 1
#define BAR_DECREASE_SPEED 5
unsigned i_prev_nb_samples;
int16_t *p_prev_s16_buff;
+
+ window_param wind_param;
} spectrum_data;
static int spectrum_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
const int *xscale;
fft_state *p_state; /* internal FFT data */
+ DEFINE_WIND_CONTEXT( wind_ctx ); /* internal window data */
int i , j , y , k;
int i_line;
p_data->i_prev_nb_samples = 0;
p_data->p_prev_s16_buff = NULL;
+
+ window_get_param( p_aout, &p_data->wind_param );
}
peaks = (int *)p_data->peaks;
prev_heights = (int *)p_data->prev_heights;
msg_Err(p_aout,"unable to initialize FFT transform");
return -1;
}
+ if( !window_init( FFT_BUFFER_SIZE, &p_data->wind_param, &wind_ctx ) )
+ {
+ fft_close( p_state );
+ free( height );
+ msg_Err(p_aout,"unable to initialize FFT window");
+ return -1;
+ }
p_buffs = p_s16_buff;
for ( i = 0 ; i < FFT_BUFFER_SIZE ; i++)
{
p_buffs = p_s16_buff;
}
+ window_scale_in_place( p_buffer1, &wind_ctx );
fft_perform( p_buffer1, p_output, p_state);
for( i = 0; i< FFT_BUFFER_SIZE ; i++ )
p_dest[i] = p_output[i] * ( 2 ^ 16 ) / ( ( FFT_BUFFER_SIZE / 2 * 32768 ) ^ 2 );
}
}
+ window_close( &wind_ctx );
+
fft_close( p_state );
free( height );
unsigned i_prev_nb_samples;
int16_t *p_prev_s16_buff;
+
+ window_param wind_param;
} spectrometer_data;
static int spectrometer_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
const double y_scale = 3.60673760222; /* (log 256) */
fft_state *p_state; /* internal FFT data */
+ DEFINE_WIND_CONTEXT( wind_ctx ); /* internal window data */
int i , j , k;
int i_line = 0;
}
p_data->i_prev_nb_samples = 0;
p_data->p_prev_s16_buff = NULL;
+ window_get_param( p_aout, &p_data->wind_param );
p_effect->p_data = (void*)p_data;
}
peaks = p_data->peaks;
free( height );
return -1;
}
+ if( !window_init( FFT_BUFFER_SIZE, &p_data->wind_param, &wind_ctx ) )
+ {
+ fft_close( p_state );
+ free( height );
+ msg_Err(p_aout,"unable to initialize FFT window");
+ return -1;
+ }
p_buffs = p_s16_buff;
for ( i = 0 ; i < FFT_BUFFER_SIZE; i++)
{
if( p_buffs >= &p_s16_buff[p_buffer->i_nb_samples * p_effect->i_nb_chans] )
p_buffs = p_s16_buff;
}
+ window_scale_in_place( p_buffer1, &wind_ctx );
fft_perform( p_buffer1, p_output, p_state);
for(i = 0; i < FFT_BUFFER_SIZE; i++)
{
}
}
+ window_close( &wind_ctx );
+
fft_close( p_state );
free( height );
#include "visual.h"
+#include "window_presets.h"
+
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define HEIGHT_LONGTEXT N_( \
"The height of the effects video window, in pixels." )
+#define FFT_WINDOW_TEXT N_( "FFT window" )
+#define FFT_WINDOW_LONGTEXT N_( \
+ "The type of FFT window to use for spectrum-based visualizations." )
+
+#define KAISER_PARAMETER_TEXT N_( "Kaiser window parameter" )
+#define KAISER_PARAMETER_LONGTEXT N_( \
+ "The parameter alpha for the Kaiser window. Increasing alpha " \
+ "increases the main-lobe width and decreases the side-lobe amplitude. " )
+
#define NBBANDS_TEXT N_( "Show 80 bands instead of 20" )
#define SPNBBANDS_LONGTEXT N_( \
"More bands for the spectrometer : 80 if enabled else 20." )
WIDTH_TEXT, WIDTH_LONGTEXT, false )
add_integer("effect-height" , VOUT_HEIGHT ,
HEIGHT_TEXT, HEIGHT_LONGTEXT, false )
+ add_string("effect-fft-window", "flat",
+ FFT_WINDOW_TEXT, FFT_WINDOW_LONGTEXT, true )
+ change_string_list( window_list, window_list_text )
+ add_float("effect-kaiser-param", 3.0f,
+ KAISER_PARAMETER_TEXT, KAISER_PARAMETER_LONGTEXT, true )
set_section( N_("Spectrum analyser") , NULL )
add_obsolete_integer( "visual-nbbands" ) /* Since 1.0.0 */
add_bool("visual-80-bands", true,