Select Git revision
ui.h 29.41 KiB
#include <stdint.h>
#include "WSerial.h"
#include "usbd_def.h"
#ifndef Ui_h
#define Ui_h
#include "Adafruit_SH110X.h"
#include "Adafruit_GFX.h"
#include "potentiometers.h"
#include "buttons.h"
#include "looper.h"
#include "button_grid.h"
#define UI_MAX_FPS 10
#define WAVEFORM_OVERSAMPLING 2
#define WAVEFORM_LIN true
extern Potentiometer pot_1, pot_2, pot_3, pot_4, pot_5, pot_6, pot_7;
extern Button button_1, button_2, button_3, button_4, button_5, button_6;
extern Adafruit_SH1106G display;
extern atoav::Looper looper_a, looper_b, looper_c, looper_d, looper_e;
// Should the splash-screen be shown on boot?
bool show_splash = false;
// Represents the possible states of the UI
enum UiMode {
UI_MODE_SPLASH, // A splash screen that is shown on startup
UI_MODE_DEFAULT, // Default screen: Show Waveform and Parameters
UI_MODE_REC_MENU, // ButtonGrid Menu: Recording Settings
UI_MODE_PLAY_MENU, // ButtonGrid Menu: Playback Settings
UI_MODE_TRIGGER_MENU, // ButtonGrid Menu: Trigger Settings
UI_MODE_FX_MENU, // ButtonGrid Menu: FX Settings
UI_MODE_BUFFER_MENU, // ButtonGrid Menu: Buffer Settings
UI_MODE_LAST
};
// Represents possible recording modes
enum RecMode {
REC_MODE_FULL, // Record into full buffer (looping back to start)
REC_MODE_LOOP, // Limit recording to the loop
REC_MODE_FULL_SHOT, // Record into full buffer, stop at the end
REC_MODE_LAST
};
// Represents possible recording sources
enum RecSource {
REC_SOURCE_PRE, // Record Incoming audio
REC_SOURCE_LAST_BUF, // Record Last selected Buffer
REC_SOURCE_OUT, // Record the buffer output
REC_SOURCE_NOISE, // Record Noise
REC_SOURCE_LAST
};
// Represents possible playback modes
enum PlayMode {
PLAY_MODE_DRUNK, // Drunken Walk
PLAY_MODE_WINDOW, // Sliding window
PLAY_MODE_LOOP, // Loop
PLAY_MODE_GRAIN, // Granular ?
PLAY_MODE_ONESHOT, // Play it once
PLAY_MODE_LAST
};
// Represents possible recording states
enum RecordingState {
REC_STATE_NOT_RECORDING, // Not recording
REC_STATE_RECORDING, // Recording (replace what is in the buffer)
REC_STATE_OVERDUBBING, // Overdubbing (mix recorded values with the existing samples)
REC_STATE_LAST