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.

87 lines
2.8KB

  1. /*
  2. MicroDexed
  3. MicroDexed is a port of the Dexed sound engine
  4. (https://github.com/asb2m10/dexed) for the Teensy-3.5/3.6 with audio shield.
  5. Dexed ist heavily based on https://github.com/google/music-synthesizer-for-android
  6. (c)2018,2019 H. Wirtz <wirtz@parasitstudio.de>
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 3 of the License, or
  10. (at your option) any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software Foundation,
  17. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #include "config.h"
  20. #define BOUNCE_WITH_PROMPT_DETECTION
  21. #include <Bounce.h>
  22. #include <EEPROM.h>
  23. #include <MIDI.h>
  24. #include "LiquidCrystalPlus_I2C.h"
  25. #include "Encoder4.h"
  26. #ifndef UI_H_INCLUDED
  27. #define UI_H_INCLUDED
  28. extern Encoder4 enc[2];
  29. extern int32_t enc_val[2];
  30. extern Bounce but[2];
  31. extern LiquidCrystalPlus_I2C lcd;
  32. extern config_t configuration;
  33. extern uint8_t max_loaded_banks;
  34. extern char bank_name[BANK_NAME_LEN];
  35. extern char voice_name[VOICE_NAME_LEN];
  36. extern uint8_t ui_state;
  37. extern uint8_t ui_main_state;
  38. extern void eeprom_write(void);
  39. extern void set_volume(float v, float pan);
  40. extern elapsedMillis autostore;
  41. extern elapsedMillis long_button_pressed;
  42. extern uint8_t effect_filter_cutoff;
  43. extern uint8_t effect_filter_resonance;
  44. extern uint8_t effect_delay_time;
  45. extern uint8_t effect_delay_feedback;
  46. extern uint8_t effect_delay_volume;
  47. extern bool effect_delay_sync;
  48. extern AudioEffectDelay delay1;
  49. extern AudioMixer4 mixer1;
  50. extern AudioMixer4 mixer2;
  51. extern value_change_t soften_volume;
  52. extern value_change_t soften_filter_res;
  53. extern value_change_t soften_filter_cut;
  54. void handle_ui(void);
  55. void ui_show_main(void);
  56. void ui_show_volume(void);
  57. void ui_show_midichannel(void);
  58. void ui_show_effects_filter(void);
  59. void ui_show_effects_delay(void);
  60. float mapfloat(float val, float in_min, float in_max, float out_min, float out_max);
  61. enum ui_states {UI_MAIN, UI_VOLUME, UI_MIDICHANNEL, UI_EFFECTS_FILTER, UI_EFFECTS_DELAY};
  62. enum ui_main_states {UI_MAIN_BANK, UI_MAIN_VOICE, UI_MAIN_BANK_SELECTED, UI_MAIN_VOICE_SELECTED, UI_MAIN_FILTER_RES, UI_MAIN_FILTER_CUT, UI_MAIN_DELAY_TIME, UI_MAIN_DELAY_FEEDBACK, UI_MAIN_DELAY_VOLUME};
  63. class MyEncoder : public Encoder
  64. {
  65. int32_t read()
  66. {
  67. return (Encoder::read() / 4);
  68. }
  69. void write(int32_t p)
  70. {
  71. Encoder::write(p * 4);
  72. }
  73. };
  74. #endif