-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDawScreens.cpp
197 lines (173 loc) · 6.67 KB
/
DawScreens.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
//
// Created by ferluht on 06/01/2024.
//
#include "Daw.h"
void DAW::draw(GFXcanvas1 *screen) {
if (last_midi_time > (SAMPLERATE / AUDIO_BUF_SIZE) * 60 && reloaded == false) {
std::exit(0);
}
AMG::draw(screen);
obd.draw(screen);
if (kbd.isactive) kbd.draw(screen);
}
inline void draw_fx_screen_header(GFXcanvas1 * screen, int idx, int size, std::string prefix, const char * fx_name) {
std::string title;
if (size > 0)
title = prefix + " " + std::to_string(idx + 1) + "/" + std::to_string(size);
else
title = prefix;
int16_t x1, y1;
uint16_t w, h;
screen->getTextBounds(fx_name, 0, 0, &x1, &y1, &w, &h);
screen->setCursor(122 - w, 6);
screen->print(fx_name);
for (int i = 0; i < 18; i ++) screen->leds[i] = 0;
screen->drawFastHLine(0, 8, 128, 1);
screen->setCursor(4, 6);
screen->setTextSize(1);
screen->print(title.c_str());
}
inline void draw_waiting_message(GFXcanvas1 * screen, bool draw) {
if (draw) {
screen->fillRect(16, 4, 96, 24, 0);
screen->drawRect(16, 4, 96, 24, 1);
screen->setCursor(32, 20);
screen->setTextSize(2);
screen->print("WAITING...");
}
}
void DAW::initScreens() {
addDrawHandler({}, [this](GFXcanvas1 * screen) -> void {
for (int i = 0; i < 18; i ++) screen->leds[i] = 0;
screen->setCursor(6, 6);
screen->setTextSize(1);
screen->print("NO SCREEN");
});
// addDrawHandler({SCREENS::LOOP_VIEW}, [this](GFXcanvas1 * screen) -> void {
// for (int i = 0; i < 18; i ++) screen->leds[i] = 0;
//
// if (recording_blink_counter > 15)
// screen->setLed(1, recording_master * 10, 0, 0);
// recording_blink_counter = (recording_blink_counter + 1) % 30;
//
// screen->drawFastVLine(96, 0, 32, 1);
// screen->drawFastHLine(0, 8, 128, 1);
//
// screen->setFont(&Picopixel);
// screen->setTextSize(1);
//
// auto selected_track = (Rack *) (tracks->get_focus());
// screen->setCursor(6, 6);
// screen->setTextSize(1);
// screen->print(("TRACK " + std::to_string(tracks->get_focus_index())).c_str());
//
// auto selected_instrument = getCurrentTrackInstrument();
// screen->setTextSize(1);
// auto instr_name = selected_instrument->getName();
// int16_t x1, y1;
// uint16_t w, h;
// screen->getTextBounds(instr_name, 0, 0, &x1, &y1, &w, &h);
// screen->setCursor(90 - w, 6);
// screen->print(instr_name);
//
// selected_instrument->draw(screen);
//
// screen->setCursor(103, 6);
// screen->setTextSize(1);
// screen->print("TAPES");
//
// tapes->draw(screen);
// });
addDrawHandler({SCREENS::TAPE_VIEW}, [this](GFXcanvas1 * screen) -> void {
for (int i = 0; i < 18; i ++) screen->leds[i] = 0;
if (recording_blink_counter > 15)
screen->setLed(1, recording_master * 10, 0, 0);
recording_blink_counter = (recording_blink_counter + 1) % 30;
screen->setFont(&Picopixel);
screen->setTextSize(1);
auto selected_instrument = getCurrentTrackInstrument();
screen->setCursor(50, 7);
screen->setTextSize(1);
auto s = "TRACK " + std::to_string(tracks->get_focus_index()) + ": " + selected_instrument->getName();
screen->print(s.c_str());
tapes->draw(screen);
});
addDrawHandler({SCREENS::TRACK_VIEW}, [this](GFXcanvas1 * screen) -> void {
auto rack = getCurrentTrackInstrument();
for (int i = 0; i < 18; i ++) screen->leds[i] = 0;
draw_fx_screen_header(screen, tracks->get_focus_index(), tracks->get_size(),
"TRACK", rack->getName());
rack->draw(screen);
});
addDrawHandler({SCREENS::MASTER_EFFECTS_MIDI}, [this](GFXcanvas1 * screen) -> void {
draw_fx_screen_header(screen, master_midi_fx->get_focus_index(), master_midi_fx->get_size(),
"MASTER MIDI FX", master_midi_fx->get_focus()->getName());
master_midi_fx->get_focus()->draw(screen);
});
addDrawHandler({SCREENS::MASTER_EFFECTS_AUDIO}, [this](GFXcanvas1 * screen) -> void {
draw_fx_screen_header(screen, master_audio_fx->get_focus_index(), master_audio_fx->get_size(),
"MASTER AUDIO FX", master_audio_fx->get_focus()->getName());
master_audio_fx->get_focus()->draw(screen);
});
addDrawHandler({SCREENS::TRACK_EFFECTS_MIDI}, [this](GFXcanvas1 * screen) -> void {
auto rack = getCurrentTrackMIDIFXRack();
draw_fx_screen_header(screen, rack->get_focus_index(), rack->get_size(),
"TRACK MIDI FX", rack->get_focus()->getName());
rack->get_focus()->draw(screen);
});
addDrawHandler({SCREENS::TRACK_EFFECTS_AUDIO}, [this](GFXcanvas1 * screen) -> void {
auto rack = getCurrentTrackAudioFXRack();
draw_fx_screen_header(screen, rack->get_focus_index(), rack->get_size(),
"TRACK AUDIO FX", rack->get_focus()->getName());
rack->get_focus()->draw(screen);
});
// addDrawHandler({SCREENS::PROJECT}, [this](GFXcanvas1 * screen) -> void {
// for (int i = 0; i < 18; i ++) screen->leds[i] = 0;
//
// draw_fx_screen_header(screen, -1, -1, "PROJECT SETTINGS", "projectname");
//
// screen->setFont(&Picopixel);
// screen->setTextSize(1);
//
// screen->setCursor(4, 16);
// screen->setTextSize(1);
//
// std::ostringstream oss;
// oss << std::setprecision(4) << sync.getBPM();
// std::string s = "BPM=" + oss.str();
// screen->print(s.c_str());
//
// screen->setCursor(4, 24);
// if (line_in) screen->print("IN: LINE");
// else screen->print("IN: MIC");
//
// std::string ssid, pwd;
// get_ssid(ssid);
// get_pwd(pwd);
// screen->setCursor(40, 16);
// screen->print(("WIFI SSID: " + ssid).c_str());
// screen->setCursor(40, 24);
// screen->print(("WIFI PASS: " + pwd).c_str());
// if (simulated_cfg) {
// screen->setCursor(120, 24);
// screen->print("S");
// }
//
//
// if (dawState == SAVING) {
// screen->fillRect(16, 4, 96, 24, 0);
// screen->drawRect(16, 4, 96, 24, 1);
// screen->setCursor(32, 20);
// screen->setTextSize(2);
// screen->print("SAVING...");
// }
//
// if (dawState == LOADING) {
// screen->fillRect(16, 4, 96, 24, 0);
// screen->drawRect(16, 4, 96, 24, 1);
// screen->setCursor(32, 20);
// screen->setTextSize(2);
// screen->print("LOADING...");
// }
// });
}