From a349a0d793c5e824eec302d64e188508ecc8a3b9 Mon Sep 17 00:00:00 2001 From: Christian Colglazier Date: Sat, 26 Sep 2020 22:28:29 -0400 Subject: [PATCH] Documentation for droplets --- src/droplets/droplet.h | 115 +++++++++++++++++++++++++++++++++-- src/droplets/noise_droplet.h | 26 +++++++- src/droplets/vco_droplet.h | 52 ++++++++++++++-- 3 files changed, 183 insertions(+), 10 deletions(-) diff --git a/src/droplets/droplet.h b/src/droplets/droplet.h index 9d730e7..a8a2d84 100644 --- a/src/droplets/droplet.h +++ b/src/droplets/droplet.h @@ -26,23 +26,128 @@ private: size_t chn_min = 0; size_t chn_max = 4; public: - Droplet(DaisyPatch*, DropletState); + /* + * Constructor for a droplet which is a mode for either half or full + * control for the daisy patch. + * + * @param m_patch pointer to patch + * @param m_state droplet position + */ + Droplet(DaisyPatch* m_patch, DropletState m_state); + + /* + * Destructor for a droplet. + */ virtual ~Droplet() {}; + + /* + * Processes user controls and inputs. + */ virtual void Control()=0; - virtual void Process(float**, float**, size_t)=0; + + /* + * Processes audio input and outputs. + * + * @param in the audio inputs for the patch + * @param out the audio outputs for the patch + * @param size the number of inputs and outputs + */ + virtual void Process(float** in, + float** out, + size_t size)=0; + + /* + * Processes information to be displayed on the screen. + */ virtual void Draw()=0; + + /* + * Returns patch + * + * @return pointer to patch + */ DaisyPatch* Patch(); + + /* + * Returns the size of the droplet. + * + * @return size of droplet + */ DropletState GetState(); + + /* + * Returns the height of the title bar of the droplet. + * + * @return height of title bar + */ int GetTitleHeight(); + + /* + * Returns the minimum screen position based on droplet size. + * + * @return droplet minimum screen position + */ int GetScreenMin(); + + /* + * Returns the maximum screen position based on droplet size. + * + * @return droplet maximum screen position + */ int GetScreenMax(); + + /* + * Returns the minimum channel position based on droplet size. + * + * @return droplet minimum channel position + */ size_t GetChannelMin(); + + /* + * Returns the maximum channel position based on droplet size. + * + * @return droplet maximum channel position + */ size_t GetChannelMax(); - void DrawName(std::string); - void UpdateState(DropletState); + + /* + * Draws droplet name on the title bar. + * + * @param name droplet position + */ + void DrawName(std::string name); + + /* + * Changes droplet position. + * + * @param m_state droplet + */ + void UpdateState(DropletState m_state); + + /* + * Updates animation clock. + */ void AnimationInc(); - void SetAnimationRate(int); + + /* + * Sets animation refresh rate + * + * @param rate display refrash rate + */ + void SetAnimationRate(int rate); + + /* + * Returns a count for total amount of animation frames. + * + * @return animation count + */ int GetAnimationCount(); + + /* + * Returns if display needs a refresh. + * + * @return display in need of update + */ bool NeedUpdate(); }; diff --git a/src/droplets/noise_droplet.h b/src/droplets/noise_droplet.h index b1cdbe9..804432f 100644 --- a/src/droplets/noise_droplet.h +++ b/src/droplets/noise_droplet.h @@ -13,9 +13,33 @@ class NoiseDroplet: public Droplet { private: daisysp::WhiteNoise noise; public: + /* + * Constructor for a droplet which outputs noise. + * + * @param m_patch pointer to patch + * @param m_state droplet position + */ NoiseDroplet(DaisyPatch*, DropletState); + + /* + * Processes user controls and inputs. + */ void Control(); - void Process(float**, float**, size_t); + + /* + * Processes audio input and outputs. + * + * @param in the audio inputs for the patch + * @param out the audio outputs for the patch + * @param size the number of inputs and outputs + */ + void Process(float** in, + float** out, + size_t size); + + /* + * Processes information to be shown on the display. + */ void Draw(); }; diff --git a/src/droplets/vco_droplet.h b/src/droplets/vco_droplet.h index adf1fbf..13643dd 100644 --- a/src/droplets/vco_droplet.h +++ b/src/droplets/vco_droplet.h @@ -19,15 +19,59 @@ class VCODroplet: public Droplet { private: Oscillator osc; Parameter freqctrl, wavectrl, ampctrl, finectrl; - std::string WaveToString(uint8_t); - void SetWaveState(uint8_t); const double pi = std::acos(-1); Wave* wave = new Wave(WaveShape::kTriangle, 21, GetTitleHeight()); + + /* + * Converts oscilator to name of wave shape. + * + * @param wf wave shape + * @return name of wave shap + */ + std::string WaveToString(uint8_t wf); + + /* + * Sets the vco wave shap to display on screen. + * + * @param wf wave shape + */ + void SetWaveState(uint8_t wf); public: - VCODroplet(DaisyPatch*, DropletState, float); + /* + * Constructor for voltage control oscillator droplet. + * + * @param m_patch pointer to patch + * @param m_state droplet position + * @param sample_rate audio sample rate + */ + VCODroplet(DaisyPatch* m_patch, + DropletState m_state, + float sample_rate); + + /* + * Destructor for vco droplet. + */ ~VCODroplet(); + + /* + * Processes user controls and inputs. + */ void Control(); - void Process(float**, float**, size_t); + + /* + * Processes audio input and outputs. + * + * @param in the audio inputs for the patch + * @param out the audio outputs for the patch + * @param size the number of inputs and outputs + */ + void Process(float** in, + float** out, + size_t size); + + /* + * Processes information to be shown on the display. + */ void Draw(); };