flizzer_tracker.h 3.3 KB

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