MicroDexed is a compatible 6-operator-FM-synth based on the Teensy(-3.6/-4.0) 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.

60 lines
1.4KB

  1. /*
  2. * Copyright 2012 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. #ifndef __FM_CORE_H
  17. #define __FM_CORE_H
  18. #include <Arduino.h>
  19. #include "aligned_buf.h"
  20. #include "fm_op_kernel.h"
  21. #include "synth.h"
  22. #include "controllers.h"
  23. class FmOperatorInfo {
  24. public:
  25. int in;
  26. int out;
  27. };
  28. enum FmOperatorFlags {
  29. OUT_BUS_ONE = 1 << 0,
  30. OUT_BUS_TWO = 1 << 1,
  31. OUT_BUS_ADD = 1 << 2,
  32. IN_BUS_ONE = 1 << 4,
  33. IN_BUS_TWO = 1 << 5,
  34. FB_IN = 1 << 6,
  35. FB_OUT = 1 << 7
  36. };
  37. class FmAlgorithm {
  38. public:
  39. int ops[6];
  40. };
  41. class FmCore {
  42. public:
  43. virtual ~FmCore() {};
  44. static void dump();
  45. uint8_t get_carrier_operators(uint8_t algorithm);
  46. virtual void render(int32_t *output, FmOpParams *params, int algorithm, int32_t *fb_buf, int feedback_gain);
  47. protected:
  48. AlignedBuf<int32_t, _N_>buf_[2];
  49. const static FmAlgorithm algorithms[32];
  50. };
  51. #endif // __FM_CORE_H