comparison Plugins/Input/wma/wma.c @ 420:44c513ae3527 trunk

[svn] Remove equalization code. We do this same processing in the core in 0.2.
author nenolod
date Fri, 13 Jan 2006 14:50:54 -0800
parents f13ab2d8e9cf
children f61e69a1a376
comparison
equal deleted inserted replaced
419:2291caab50ca 420:44c513ae3527
35 #include <libaudacious/util.h> 35 #include <libaudacious/util.h>
36 #include <libaudacious/titlestring.h> 36 #include <libaudacious/titlestring.h>
37 37
38 #include "avcodec.h" 38 #include "avcodec.h"
39 #include "avformat.h" 39 #include "avformat.h"
40 #include "iir.h"
41 40
42 #define ABOUT_TXT "Adapted for use in audacious by Tony Vroon (chainsaw@gentoo.org) from\n \ 41 #define ABOUT_TXT "Adapted for use in audacious by Tony Vroon (chainsaw@gentoo.org) from\n \
43 the BEEP-WMA plugin which is Copyright (C) 2004,2005 Mokrushin I.V. aka McMCC (mcmcc@mail.ru).\n \ 42 the BEEP-WMA plugin which is Copyright (C) 2004,2005 Mokrushin I.V. aka McMCC (mcmcc@mail.ru).\n \
44 This plugin based on source code " LIBAVCODEC_IDENT "\nby Fabrice Bellard from \ 43 This plugin based on source code " LIBAVCODEC_IDENT "\nby Fabrice Bellard from \
45 http://ffmpeg.sourceforge.net.\n\n \ 44 http://ffmpeg.sourceforge.net.\n\n \
97 NULL, // Scan dir 96 NULL, // Scan dir
98 wma_play_file, // Play file 97 wma_play_file, // Play file
99 wma_stop, // Stop 98 wma_stop, // Stop
100 wma_do_pause, // Pause 99 wma_do_pause, // Pause
101 wma_seek, // Seek 100 wma_seek, // Seek
102 wma_set_eq, // Set the equalizer, most plugins won't be able to do this 101 NULL, // We don't use this in audacious.
103 wma_get_time, // Get the time, usually returns the output plugins output time 102 wma_get_time, // Get the time, usually returns the output plugins output time
104 NULL, // Get volume 103 NULL, // Get volume
105 NULL, // Set volume 104 NULL, // Set volume
106 NULL, // OBSOLETE! 105 NULL, // OBSOLETE!
107 NULL, // OBSOLETE! 106 NULL, // OBSOLETE!
179 static void wma_init(void) 178 static void wma_init(void)
180 { 179 {
181 avcodec_init(); 180 avcodec_init();
182 avcodec_register_all(); 181 avcodec_register_all();
183 av_register_all(); 182 av_register_all();
184 init_iir();
185 } 183 }
186 184
187 static int wma_is_our_file(char *filename) 185 static int wma_is_our_file(char *filename)
188 { 186 {
189 gchar *ext; 187 gchar *ext;
211 static int wma_get_time(void) 209 static int wma_get_time(void)
212 { 210 {
213 wma_ip.output->buffer_free(); 211 wma_ip.output->buffer_free();
214 if(wma_decode) return wma_ip.output->output_time(); 212 if(wma_decode) return wma_ip.output->output_time();
215 return -1; 213 return -1;
216 }
217
218 static void wma_set_eq(int q_on, float q_preamp, float *q_bands)
219 {
220 int chn;
221 int index;
222 float value;
223
224 wma_eq_on = q_on;
225 if(wma_eq_on)
226 {
227 q_preamp = q_preamp/1.6;
228 for(chn = 0; chn < c->channels; chn++)
229 preamp[chn] = 1.0 + 0.0932471 * q_preamp + 0.00279033 * q_preamp * q_preamp;
230 for(index = 0; index < 10; index++)
231 {
232 value = q_bands[index]/1.2;
233 for(chn = 0; chn < c->channels; chn++)
234 gain[index][chn] = 0.03 * value + 0.000999999 * value * value;
235 }
236 }
237 } 214 }
238 215
239 static gchar *extname(const char *filename) 216 static gchar *extname(const char *filename)
240 { 217 {
241 gchar *ext = strrchr(filename, '.'); 218 gchar *ext = strrchr(filename, '.');
320 297
321 fifo_init(&f, out_size*2); 298 fifo_init(&f, out_size*2);
322 fifo_write(&f, wma_outbuf, out_size, &f.wptr); 299 fifo_write(&f, wma_outbuf, out_size, &f.wptr);
323 while(!fifo_read(&f, wma_s_outbuf, wma_st_buff, &f.rptr) && wma_decode) 300 while(!fifo_read(&f, wma_s_outbuf, wma_st_buff, &f.rptr) && wma_decode)
324 { 301 {
325 if(wma_eq_on)
326 sst_buff = iir((gpointer)&wma_s_outbuf, wma_st_buff);
327 else
328 sst_buff = wma_st_buff;
329 if(wma_pause) memset(wma_s_outbuf, 0, sst_buff); 302 if(wma_pause) memset(wma_s_outbuf, 0, sst_buff);
330 while(wma_ip.output->buffer_free() < wma_st_buff) xmms_usleep(20000); 303 while(wma_ip.output->buffer_free() < wma_st_buff) xmms_usleep(20000);
331 produce_audio(wma_ip.output->written_time(), FMT_S16_NE, 304 produce_audio(wma_ip.output->written_time(), FMT_S16_NE,
332 c->channels, sst_buff, (short *)wma_s_outbuf, NULL); 305 c->channels, sst_buff, (short *)wma_s_outbuf, NULL);
333 memset(wma_s_outbuf, 0, sst_buff); 306 memset(wma_s_outbuf, 0, sst_buff);