Synthesizer based on the Unzen / Nucleo F746ZG

Dependencies:   amakusa mbed-dsp mbed shimabara ukifune unzen_nucleo_f746

Fork of skeleton_unzen_nucleo_f746 by seiichi horie

雲仙フレームワークのテストとして作っているプロジェクトです。中身はどんどん変っていきます。 説明はDSP空挺団の「シンセサイザー」カテゴリーを参照してください。初回は「ドッグフードを食べる」です。

Revision:
17:728ffc633179
Parent:
13:b33cb5925113
Child:
18:b9b1116f8768
--- a/main.cpp	Tue Jan 31 12:52:59 2017 +0000
+++ b/main.cpp	Tue Jan 31 14:19:16 2017 +0000
@@ -42,33 +42,47 @@
 int main() 
 {    
     uint32_t pushing, releasing, holding;
+    
+        // VFO style
+    wave_style style = triangle;
 
         // start audio. Do not touch
     initialize_system();
+    
+    process->set_vfo_frequency( 440 );
+    process->set_vfo_wave_style( style );
+    ukifune::turn_led_off( ukifune::led1_1 );
+    ukifune::turn_led_on( ukifune::led1_2 );
  
        // main loop. Signal processing is done in background.
     while(1)     
     {       // place your foreground program here.
 
             // get volume from UI panel, then apply it to signal processing.
-        process->set_volume( ukifune::get_volume(0) );   
+        process->set_volume( ukifune::get_volume(0) );  
+        process->set_vfo_duty_cycle( ukifune::get_volume(1) ); 
        
             // sample usage of button switch detection
         ukifune::get_button_state( pushing, releasing, holding);
 
             // pushing detection demo
         if ( pushing & (1 << ukifune::swm1 ) )      // is SWM1 switch pusshing down?
-            ukifune::toggle_led( ukifune::led1_1 ); // then, toggle LED1_1 
+            if  ( style == triangle )
+            {
+                style = square;
+                process->set_vfo_wave_style( style );
+                ukifune::turn_led_on( ukifune::led1_1 );
+                ukifune::turn_led_off( ukifune::led1_2 );
+            }
+            else
+            {
+                style = triangle;
+                process->set_vfo_wave_style( style );
+                ukifune::turn_led_off( ukifune::led1_1 );
+                ukifune::turn_led_on( ukifune::led1_2 );
+            }
+            
 
-            // releasing detection demo     
-        if ( releasing & (1 << ukifune::swm2 ) )    // is SWM2 switch releasing? 
-            ukifune::toggle_led( ukifune::led2_1 ); // then toggle LED2_1
-       
-            // holding detection demo     
-        if ( holding & (1 << ukifune::swm3 ) )    // is SWM3 switch holding? 
-            ukifune::turn_led_on( ukifune::led3_1 );    // then turn LED3_1 on
-        else
-            ukifune::turn_led_off( ukifune::led3_1 );   // else off
 
        
             // you have to call tick() every 20mS-50mS if you need get_volume()