Guest User

Untitled

a guest
Dec 19th, 2013
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // bass synth
  2. // 1 = SinOsc
  3. // 2 = TriOsc
  4.  
  5. public class SomeSynth
  6. {
  7. // null references to two types of oscillators
  8. SinOsc @ sin1;
  9. SinOsc @ sin2;
  10.  
  11. TriOsc @ tri1;
  12. TriOsc @ tri2;
  13.  
  14. // initialize the oscillators, connect them to dac and set gain to zero
  15. fun void init(int osc1, int osc2)
  16. {
  17. if (osc1 == 1) new SinOsc @=> sin1 => dac;
  18. if (osc1 == 2) new TriOsc @=> tri1 => dac;
  19.  
  20. if (osc2 == 1) new SinOsc @=> sin2 => dac;
  21. if (osc2 == 2) new TriOsc @=> tri2 => dac;
  22.  
  23. this.noteOff();
  24.  
  25. }
  26.  
  27. fun void noteOff()
  28. {
  29. 0 => sin1.gain => tri1.gain => sin2.gain => tri2.gain;
  30. }
  31. }
  32.  
  33. SomeSynth ss;
  34. ss.init(1, 2); // create a SinOsc and a TriOsc
Advertisement
Add Comment
Please, Sign In to add comment