Helpers and hardware definitions for daisy petal. More...
Helpers and hardware definitions for daisy petal.
#include <daisy_petal.h>
Public Types | |
enum | Sw { SW_1 , SW_2 , SW_3 , SW_4 , SW_5 , SW_6 , SW_7 , SW_LAST } |
enum | Knob { KNOB_1 , KNOB_2 , KNOB_3 , KNOB_4 , KNOB_5 , KNOB_6 , KNOB_LAST } |
enum | RingLed { RING_LED_1 , RING_LED_2 , RING_LED_3 , RING_LED_4 , RING_LED_5 , RING_LED_6 , RING_LED_7 , RING_LED_8 , RING_LED_LAST } |
enum | FootswitchLed { FOOTSWITCH_LED_1 , FOOTSWITCH_LED_2 , FOOTSWITCH_LED_3 , FOOTSWITCH_LED_4 , FOOTSWITCH_LED_LAST } |
Public Member Functions | |
DaisyPetal () | |
~DaisyPetal () | |
void | Init (bool boost=false) |
void | DelayMs (size_t del) |
void | StartAudio (AudioHandle::InterleavingAudioCallback cb) |
void | StartAudio (AudioHandle::AudioCallback cb) |
void | ChangeAudioCallback (AudioHandle::InterleavingAudioCallback cb) |
void | ChangeAudioCallback (AudioHandle::AudioCallback cb) |
void | StopAudio () |
void | SetAudioSampleRate (SaiHandle::Config::SampleRate samplerate) |
float | AudioSampleRate () |
void | SetAudioBlockSize (size_t size) |
size_t | AudioBlockSize () |
float | AudioCallbackRate () |
void | StartAdc () |
void | StopAdc () |
void | ProcessAnalogControls () |
void | ProcessAllControls () |
float | GetKnobValue (Knob k) |
float | GetExpression () |
void | ProcessDigitalControls () |
void | ClearLeds () |
void | UpdateLeds () |
void | SetRingLed (RingLed idx, float r, float g, float b) |
void | SetFootswitchLed (FootswitchLed idx, float bright) |
Public Attributes | |
DaisySeed | seed |
Encoder | encoder |
AnalogControl | knob [KNOB_LAST] |
AnalogControl | expression |
Switch | switches [SW_LAST] |
RgbLed | ring_led [8] |
Led | footswitch_led [4] |
|
inline |
Constructor
|
inline |
Destructor
size_t daisy::DaisyPetal::AudioBlockSize | ( | ) |
Returns the number of samples per channel in a block of audio.
float daisy::DaisyPetal::AudioCallbackRate | ( | ) |
Returns the rate in Hz that the Audio callback is called
float daisy::DaisyPetal::AudioSampleRate | ( | ) |
Returns the audio sample rate in Hz as a floating point number.
void daisy::DaisyPetal::ChangeAudioCallback | ( | AudioHandle::AudioCallback | cb | ) |
Switch callback functions
cb | New multichannel callback function. |
void daisy::DaisyPetal::ChangeAudioCallback | ( | AudioHandle::InterleavingAudioCallback | cb | ) |
Switch callback functions
cb | New interleaved callback function. |
void daisy::DaisyPetal::ClearLeds | ( | ) |
Turn all leds off
Wait before moving on.
del | Delay time in ms. |
float daisy::DaisyPetal::GetExpression | ( | ) |
&
Get value per knob.
k | Which knob to get |
|
inline |
Process Analog and Digital Controls
void daisy::DaisyPetal::ProcessAnalogControls | ( | ) |
Call at the same frequency as controls are read for stable readings.
void daisy::DaisyPetal::ProcessDigitalControls | ( | ) |
Process digital controls
Sets the number of samples processed per channel by the audio callback.
size | Audio block size |
void daisy::DaisyPetal::SetAudioSampleRate | ( | SaiHandle::Config::SampleRate | samplerate | ) |
Updates the Audio Sample Rate, and reinitializes. Audio must be stopped for this to work.
void daisy::DaisyPetal::SetFootswitchLed | ( | FootswitchLed | idx, |
float | bright | ||
) |
Set footswitch LED
idx | Led Index |
bright | Brightness |
Set ring LED colors
idx | Index to set |
r | Red value |
g | Green value |
b | Blue value |
void daisy::DaisyPetal::StartAdc | ( | ) |
Start analog to digital conversion.
void daisy::DaisyPetal::StartAudio | ( | AudioHandle::AudioCallback | cb | ) |
Starts the callback
cb | multichannel callback function |
void daisy::DaisyPetal::StartAudio | ( | AudioHandle::InterleavingAudioCallback | cb | ) |
Starts the callback
cb | Interleaved callback function |
void daisy::DaisyPetal::StopAdc | ( | ) |
Stops Transfering data from the ADC
void daisy::DaisyPetal::StopAudio | ( | ) |
Stops the audio if it is running.
void daisy::DaisyPetal::UpdateLeds | ( | ) |
Update Leds to values you had set.
Encoder daisy::DaisyPetal::encoder |
&
AnalogControl daisy::DaisyPetal::expression |
&
Led daisy::DaisyPetal::footswitch_led[4] |
&
AnalogControl daisy::DaisyPetal::knob[KNOB_LAST] |
&
RgbLed daisy::DaisyPetal::ring_led[8] |
&
DaisySeed daisy::DaisyPetal::seed |
&