WavePlayer audio effects

Fork of wave_player by Stuart Kent

Files at this revision

API Documentation at this revision

Comitter:
acorness
Date:
Tue Nov 18 23:18:45 2014 +0000
Parent:
2:32da40a33717
Commit message:
IT LIVES

Changed in this revision

wave_player.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 32da40a33717 -r 06bc8350c139 wave_player.cpp
--- a/wave_player.cpp	Tue Nov 18 22:26:27 2014 +0000
+++ b/wave_player.cpp	Tue Nov 18 23:18:45 2014 +0000
@@ -18,7 +18,7 @@
 #include <shared.h>
 
 Wiistate wiistate = Nothing;
-float vol = 0; //VOLUME FLOAT
+float vol = 1.0f; //VOLUME FLOAT
 Mutex key;
 
 
@@ -48,10 +48,14 @@
 int do_bit_crush = 0;
 int do_delay = 1;
 
+float cur_vol = 0;
+
 void update_state() {
     Wiistate cur_state;
+    
     key.lock();
         cur_state = wiistate;
+        cur_vol = vol;
     key.unlock();
     
     if(cur_state == Left) {
@@ -75,7 +79,7 @@
             do_bit_crush = 0;
             do_delay = 1;
     } else if(cur_state == Nothing) {
-            do_vol = 0;
+            do_vol = 1;
             do_flange = 0;
             do_bit_crush = 0;
             do_delay = 0;
@@ -326,9 +330,10 @@
           
           float time_in_period = (float)cur_samp_cnt/(float)SAMPLE_RATE;
           //float vol = 0.5 + 0.5*sin(2*M_PI*time_in_period); // Full dynamic range
-          float my_vol = 0.75 + 0.25*sin(2*M_PI*time_in_period);
+          //float my_vol = 0.75 + 0.25*sin(2*M_PI*time_in_period);
           
-          if(do_vol) f_mix = (my_vol*f_mix);
+          //if(do_vol) f_mix = (my_vol*f_mix);
+          if(do_vol) f_mix = (cur_vol*f_mix);
           
           if(do_bit_crush) {
               short unsigned beef = (short unsigned)f_mix;