simulations

numerical experiments, simulations and learning projects
git clone https://damianlofi.de/git/simulations.git
Log | Files | Refs | README

control.c (664B)


      1 #include "control.h"
      2 #include <stdio.h>
      3 #include <stdatomic.h>
      4 
      5 int control_run(synthesizer *synth)
      6 {
      7     while (1) {
      8         int c = getchar();
      9 
     10         (void) synth;
     11 
     12         float base = 200.0;
     13 
     14         if (c == 'j') {
     15             float inc = base / synth->sr;
     16             atomic_store(&synth->vco1.inc_target, inc);
     17         }
     18         if (c == 'k') {
     19             float inc = base *2 / synth->sr;
     20             atomic_store(&synth->vco1.inc_target, inc);
     21         }
     22         if (c == 'l') {
     23             float inc = base * 4/ synth->sr;
     24             atomic_store(&synth->vco1.inc_target, inc);
     25         }
     26         if (c == 'x') {
     27             return 0;
     28         }
     29     }
     30 }