#include <frame.h>
Inheritance diagram for InternalAudioResample< input_t, output_t >:


Public Member Functions | |
| InternalAudioResample () | |
| InternalAudioResample (double output_rate) | |
| virtual | ~InternalAudioResample () |
| void | Resample (input_t *input, double input_rate, int channels, int samples) |
| Simple up and down resampler for people unable to handle 48khz audio. | |
|
|||||||||
|
Definition at line 271 of file frame.h. 00271 : AudioResample<input_t,output_t>( 0 ) 00272 { }
|
|
||||||||||
|
Definition at line 273 of file frame.h. 00273 : AudioResample<input_t,output_t>( output_rate ) 00274 { }
|
|
|||||||||
|
Definition at line 275 of file frame.h. 00276 { }
|
|
||||||||||||||||||||||||
|
Simple up and down resampler for people unable to handle 48khz audio. Also fixes mixed projects with 32khz and 48khz audio sampling (yippee!). Reimplemented from AudioResample< input_t, output_t >. Definition at line 281 of file frame.h. References AudioResample< input_t, output_t >::output, AudioResample< input_t, output_t >::output_rate, and AudioResample< input_t, output_t >::size. 00282 {
00283 float ratio = ( float ) this->output_rate / ( float ) input_rate;
00284 this->size = ( int ) ( ( float ) samples * ratio );
00285
00286 int rounding = 1 << 15;
00287 unsigned int xfactor = ( samples << 16 ) / this->size;
00288 unsigned int xmax = xfactor * this->size;
00289 unsigned int i = 0;
00290 unsigned int o = 0;
00291 this->size *= sizeof(output_t) * channels;
00292
00293 for ( unsigned int xft = 0; xft < xmax; xft += xfactor )
00294 {
00295 i = ( ( xft + rounding ) >> 16 ) * channels;
00296 for (int c=0; c < channels; c++)
00297 this->output[o+c] = input[i+c];
00298 o += channels;
00299 }
00300
00301 }
|
1.4.2