For this one we have the following code
static float doppler_get_pulse_int ( float c, float t) { double d; if ( c > c2 ) return t/(2.5 * c2); d = sin(b/d) * sin(a/b); return d*t; }
Which can be written
static sint32 doppler_get_pulse_int ( sint32 t, double d ) { float p = doppler_get_pulse_int ( t ); double e = sin (p/d); if ( t != 0.0 && t != 1.0 ) { if ( e > sf ) { return ( 2.0 – e ); } p = – e * sin ( e% sf ); return Doppler_get_pulse_int ( t, e ); } else { return e; } }
And if you look in the code to the right you will notice that Doppler_get_pulse_int was replaced with Doppler_get_pulse_int_v4 that only performs the p / d calculation. I wrote a small function for that calculation and I also removed the PPM calculation of b and e to add to the p / d calculation.
I’ve also added the following tests to my code
void main ( int argc, char * argv[]) { int i; double c; int s; int p, d; int t; s= 0 ; p = 0 ; d= 0 ; t= 0.0 ; c= 0 ; for (i= 0 ; i<8 ; i++) { printf ( "Doppler Pulse %i
” ,i); printf ( “Doppler Pulse %i
” ,( int )(i / 8 )); printf ( “Pulse %i
” ,p); printf ( “Pulse %i
” ,( double )(p / 2.5 )); printf ( “Pulse %i
” ,t); } printf ( “Samples:
” ); printf ( “Output:
” ); if ((i > 8 ) && (c < 0.0 )) { printf ( "Error: Doppler is not capable of controlling the volume. PPM is required. " ); printf ( "Test #1: " ); printf (