MicroDexed is a compatible 6-operator-FM-synth based on the Teensy(-3.6/-4.x) Microcontroller. https://www.parasitstudio.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.1 KiB

  1. /*
  2. * Copyright 2013 Google Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. // Low frequency oscillator, compatible with DX7
  17. class Lfo {
  18. public:
  19. static void init(FRAC_NUM sample_rate);
  20. void reset(const uint8_t params[6]);
  21. // result is 0..1 in Q24
  22. int32_t getsample();
  23. // result is 0..1 in Q24
  24. int32_t getdelay();
  25. void keydown();
  26. private:
  27. static uint32_t unit_;
  28. uint32_t phase_; // Q32
  29. uint32_t delta_;
  30. uint8_t waveform_;
  31. uint8_t randstate_;
  32. bool sync_;
  33. uint32_t delaystate_;
  34. uint32_t delayinc_;
  35. uint32_t delayinc2_;
  36. };