Documented functions for main, menu, and util

This commit is contained in:
Christian Colglazier 2020-09-26 21:00:57 -04:00
parent a351030fe4
commit 8ce16da281
3 changed files with 167 additions and 32 deletions

View File

@ -19,10 +19,38 @@ Menu menu(&patch);
Droplet* droplet;
float sample_rate;
/*
* Processes user controls and inputs.
*/
void ProcessControls();
/*
* Processes information to be displayed on the screen.
*/
void ProcessOled();
/*
* Processes patch outputs.
*/
void ProcessOutputs();
static void AudioThrough(float **, float **, size_t);
/*
* Processes audio input and outputs with a faster and higher priority control
* loop.
*
* @param in the audio inputs for the patch
* @param out the audio outputs for the patch
* @param size the number of inputs and outputs
*/
static void AudioThrough(float** in,
float** out,
size_t size);
/*
* Initializes a new audio processing droplet based on menu state.
*
* @return a droplet
*/
Droplet* GetDroplet();
#endif // CASCADE_MAIN_H_

View File

@ -16,15 +16,74 @@ class Menu {
private:
DaisyPatch* patch;
public:
Menu(DaisyPatch*);
/*
* Constructor for a menu system to control the state of the patch.
*
* @param m_patch pointer to patch
*/
Menu(DaisyPatch* m_patch);
/*
* Gives if the user is currently in the menu.
*
* @return menu active
*/
bool InMenu();
/*
* Sets if the user is in the menu.
*
* @param menu active
*/
void SetInMenu(bool);
/*
* Keeps menu selection within the bounds of the menu's size.
*/
void FilterMenuSelection();
std::string FilterMenuText(int);
void CreateMenuItem(std::string, int, bool);
/*
* Returns item name based on given position and if out of the menu
* returns a blank string.
*
* @param position place in the menu
* @return menu item name
*/
std::string FilterMenuText(int position);
/*
* Draws a menu item on screen.
*
* @param text menu item name
* @param position menu items position in the menu
* @param highlighted state of menu items selection
*/
void CreateMenuItem(std::string text,
int position,
bool highlighted);
/*
* Draws droplet information on the screen.
*/
void ProcessMenuOled();
/*
* Updates menu position based on user input from the encoder.
*/
void UpdateMenuPosition();
/*
* Returns the name of the currently selected menu item.
*
* @return selected menu item's name
*/
std::string SelectedName();
/*
* Returns the currently selected menu item.
*
* @return menu state
*/
MenuState GetState();
};

View File

@ -9,37 +9,85 @@
using namespace daisy;
void DrawSolidRect(DaisyPatch,
uint8_t,
uint8_t,
uint8_t,
uint8_t,
bool);
/*
* Draws a solid rectangle on screen.
*
* @param patch daisy patch board
* @param x1 x coordinate of the first point
* @param y1 y coordinate of the first point
* @param x2 x coordinate of the second point
* @param y2 y coordinate of the second point
* @param on draw screen on or off
*/
void DrawSolidRect(DaisyPatch patch,
uint8_t x1,
uint8_t y1,
uint8_t x2,
uint8_t y2,
bool on);
void WriteString(DaisyPatch,
int,
int,
FontDef,
std::string,
bool);
/*
* Draws text on screen flushed left.
*
* @param patch daisy patch board
* @param x start of text x coordinate
* @param y start of text y coordinate
* @param font text font
* @param text text to be written
* @param on draw screen on or off
*/
void WriteString(DaisyPatch patch,
int x,
int y,
FontDef font,
std::string text,
bool on);
void WriteString(DaisyPatch,
int,
int,
FontDef,
std::string);
/*
* Draws text on screen flushed left.
*
* @param patch daisy patch board
* @param x start of text x coordinate
* @param y start of text y coordinate
* @param font text font
* @param text text to be written
*/
void WriteString(DaisyPatch patch,
int x,
int y,
FontDef font,
std::string text);
void WriteCenteredString(DaisyPatch,
int,
int,
FontDef,
std::string,
bool);
/*
* Draws text on screen centered.
*
* @param patch daisy patch board
* @param x center of text x coordinate
* @param y start of text y coordinate
* @param font text font
* @param text text to be written
* @param on draw screen on or off
*/
void WriteCenteredString(DaisyPatch patch,
int x,
int y,
FontDef font,
std::string font,
bool on);
void WriteCenteredString(DaisyPatch,
int,
int,
FontDef,
std::string);
/*
* Draws text on screen centered.
*
* @param patch daisy patch board
* @param x center of text x coordinate
* @param y start of text y coordinate
* @param font text font
* @param text text to be written
*/
void WriteCenteredString(DaisyPatch patch,
int x,
int y,
FontDef font,
std::string text);
#endif // CASCADE_UTIL_H_