maths api changes and random
[vg.git] / projects / birds.c
index 81646be31a03396f387c5b3fce3852376ee54032..a07d818f61ea9b30355c230a52623cca11d7adbb 100644 (file)
@@ -5,6 +5,7 @@
 
 #define SYNTH_BIRD_STDLIB
 #include "vg_audio_synth_bird.h"
+#include "vg_m.h"
 
 #define WRAP1S( X ) (X)%44100
 
  *
  */
 
-static double rand_float( double min, double max )
-{
-   double r = (double)(rand()&(4096-1))*(1.0/4096.0);
-   return min + r*(max-min);
-}
-
-static int rand_seconds( double min, double max )
-{
-   return rand_float( min*44100.0, max*44100.0 );
-}
-
 static void vg_dsp_init( void );
 static void vg_dsp_process( float *stereo_in, float *stereo_out );
 
@@ -212,16 +202,10 @@ static struct dsp_delay __echos[8];
 static struct dsp_lpf   __echos_lpf[8];
 static struct dsp_schroeder __diffusion_chain[8];
 
-static inline float vg_lerpf( float a, float b, float t )
-{
-   return a + t*(b-a);
-}
-
 static void vg_dsp_init( void )
 {
    /* temporary global design */
 
-
    dsp_init_lpf( &__lpf_mud_free, 125.0f );
    dsp_init_lpf( &__hpf_mud_free, 500.0f );
 
@@ -234,7 +218,7 @@ static void vg_dsp_init( void )
    {
       float reflection_time = ((sizes[i])/343.0f) * 1000.0f;
 
-      float var   = 1.0f + rand_float(-1.0,1.0) * reflection_variance,
+      float var   = 1.0f + vg_randf64_range(-1.0,1.0) * reflection_variance,
             total = reflection_time * var;
 
       dsp_init_delay( &__echos[i], total / 1000.0f );