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.

54 lines
807B

  1. #pragma once
  2. #include "bogaudio.hpp"
  3. #include "dsp/oscillator.hpp"
  4. #include "dsp/pitch.hpp"
  5. using namespace bogaudio::dsp;
  6. extern Model* modelReftone;
  7. namespace bogaudio {
  8. struct Reftone : Module {
  9. enum ParamsIds {
  10. PITCH_PARAM,
  11. OCTAVE_PARAM,
  12. FINE_PARAM,
  13. NUM_PARAMS
  14. };
  15. enum InputsIds {
  16. NUM_INPUTS
  17. };
  18. enum OutputsIds {
  19. CV_OUTPUT,
  20. OUT_OUTPUT,
  21. NUM_OUTPUTS
  22. };
  23. enum LightsIds {
  24. NUM_LIGHTS
  25. };
  26. int _pitch = 9;
  27. int _octave = 4;
  28. float _fine = 0.0f;
  29. float _frequency = 440.0f;
  30. float _cv = frequencyToCV(_frequency);
  31. SineOscillator _sine;
  32. Reftone() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {
  33. onSampleRateChange();
  34. }
  35. void onSampleRateChange() override {
  36. _sine.setSampleRate(engineGetSampleRate());
  37. }
  38. void step() override;
  39. };
  40. } // namespace bogaudio