flizzer_tracker.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #pragma once
  2. #include <cli/cli.h>
  3. #include <furi.h>
  4. #include <gui/gui.h>
  5. #include <input/input.h>
  6. #include <notification/notification_messages.h>
  7. #include <stdio.h>
  8. #include <u8g2_glue.h>
  9. #include <gui/modules/text_input.h>
  10. #include <gui/view_dispatcher.h>
  11. #include "flizzer_tracker_hal.h"
  12. #include "sound_engine/freqs.h"
  13. #include "sound_engine/sound_engine_defs.h"
  14. #include "sound_engine/sound_engine_filter.h"
  15. #include "tracker_engine/tracker_engine_defs.h"
  16. typedef enum
  17. {
  18. EventTypeInput,
  19. } EventType;
  20. typedef struct
  21. {
  22. EventType type;
  23. InputEvent input;
  24. uint32_t period;
  25. } FlizzerTrackerEvent;
  26. typedef enum
  27. {
  28. PATTERN_VIEW,
  29. INST_EDITOR_VIEW,
  30. EXPORT_WAV_VIEW,
  31. } TrackerMode;
  32. typedef enum
  33. {
  34. EDIT_PATTERN,
  35. EDIT_SEQUENCE,
  36. EDIT_SONGINFO,
  37. EDIT_INSTRUMENT,
  38. EDIT_PROGRAM,
  39. } TrackerFocus;
  40. typedef enum
  41. {
  42. SI_PATTERNPOS,
  43. SI_SEQUENCEPOS,
  44. SI_SONGSPEED,
  45. SI_SONGRATE,
  46. SI_MASTERVOL,
  47. SI_SONGNAME,
  48. SI_CURRENTINSTRUMENT,
  49. SI_INSTRUMENTNAME,
  50. /* ======== */
  51. SI_PARAMS,
  52. } SongInfoParam;
  53. typedef enum
  54. {
  55. INST_CURRENTINSTRUMENT,
  56. INST_INSTRUMENTNAME,
  57. INST_CURRENT_NOTE,
  58. INST_FINETUNE,
  59. INST_SLIDESPEED,
  60. INST_SETPW,
  61. INST_PW,
  62. INST_SETCUTOFF,
  63. INST_WAVE_NOISE,
  64. INST_WAVE_PULSE,
  65. INST_WAVE_TRIANGLE,
  66. INST_WAVE_SAWTOOTH,
  67. INST_WAVE_NOISE_METAL,
  68. INST_WAVE_SINE,
  69. INST_ATTACK,
  70. INST_DECAY,
  71. INST_SUSTAIN,
  72. INST_RELEASE,
  73. INST_VOLUME,
  74. INST_ENABLEFILTER,
  75. INST_FILTERCUTOFF,
  76. INST_FILTERRESONANCE,
  77. INST_FILTERTYPE,
  78. INST_ENABLERINGMOD,
  79. INST_RINGMODSRC,
  80. INST_ENABLEHARDSYNC,
  81. INST_HARDSYNCSRC,
  82. INST_RETRIGGERONSLIDE,
  83. INST_ENABLEKEYSYNC,
  84. INST_ENABLEVIBRATO,
  85. INST_VIBRATOSPEED,
  86. INST_VIBRATODEPTH,
  87. INST_VIBRATODELAY,
  88. INST_ENABLEPWM,
  89. INST_PWMSPEED,
  90. INST_PWMDEPTH,
  91. INST_PWMDELAY,
  92. INST_PROGRAMEPERIOD,
  93. /* ======== */
  94. INST_PARAMS,
  95. } InstrumentParam;
  96. typedef struct
  97. {
  98. View *view;
  99. void *context;
  100. } TrackerView;
  101. typedef enum
  102. {
  103. VIEW_TRACKER,
  104. VIEW_KEYBOARD,
  105. VIEW_FILE_MANAGER,
  106. VIEW_SUBMENU,
  107. } FlizzerTrackerViews;
  108. typedef struct
  109. {
  110. NotificationApp *notification;
  111. FuriMessageQueue *event_queue;
  112. Gui *gui;
  113. TrackerView *tracker_view;
  114. ViewDispatcher *view_dispatcher;
  115. TextInput *text_input;
  116. bool was_it_back_keypress;
  117. uint32_t current_time;
  118. uint32_t period;
  119. SoundEngine sound_engine;
  120. TrackerEngine tracker_engine;
  121. TrackerSong song;
  122. uint8_t selected_param;
  123. uint8_t mode, focus;
  124. uint8_t patternx, current_channel, current_digit, program_step, current_instrument, current_note;
  125. uint8_t inst_editor_shift;
  126. bool editing;
  127. bool was_editing;
  128. bool quit;
  129. } FlizzerTrackerApp;
  130. typedef struct
  131. {
  132. FlizzerTrackerApp *tracker;
  133. } TrackerViewModel;