Class fx_pedal

Class Documentation

class fx_pedal

The pedal.

The pedal object is the root of all functionality on DreamMakerFx. We reference this object when wiring effects together and controlling the various knobs, buttons, lights, etc.

An effect will always have a few common elements:

#include <dreammakerfx.h>

void setup() {

  // Initialize the pedal hardware
  pedal.init();    

  // Route audio through the pedal to any effects modules
  pedal.route_audio(pedal.instr_in, pedal.amp_out);


  // Run the effect on the DSP
  pedal.run();

}

void loop() {

  // Exchange information wiht the DSP
  pedal.service();

}

There are several other functions that control the buttons, lights/LEDs, knobs/pots and toggle switches.

Public Functions

fx_pedal()
void init(void)

Initializes the pedal object with default debug level (just warnings and errors)

void init(DEBUG_MSG_LEVEL debug_level)

Initializes the pedal object with user defined debug level.

Parameters
  • [in] debug_level: The debug level to display (MSG_DEBUG, MSG_INFO, MSG_WARN, MSG_ERROR)

void init(DEBUG_MSG_LEVEL debug_level, bool dsp_no_reset)

Initializes the pedal object with used defined debug level, bypasses DSP reset.

Parameters
  • [in] debug_level: The debug level to display (MSG_DEBUG, MSG_INFO, MSG_WARN, MSG_ERROR)

  • [in] dsp_no_reset: The dsp no reset (set to true to bypass reset)

void init(bool debug_enable)
void init(bool debug_enable, bool dsp_telem)
bool run(void)

Runs the current canvas (i.e. compiles and downloads to the DSP)

Return

True if successful, false if not

void service(void)

Pedal service function that should be called in the Arduino loop() function.

bool route_audio(fx_audio_node *out, fx_audio_node *in)

Routes a source node (output) to a destination mode (input)

Return

True is successful, false if not

Parameters
  • src: The source / output

  • dest: The destination / input

bool route_control(fx_control_node *src, fx_control_node *dest)

Route a control source node (output) to a destination mode (input)

Return

True is successful, false if not

Parameters
  • src: The source node (should be an output)

  • dest: The destination node (should be an input)

bool route_control(fx_control_node *src, fx_control_node *dest, float scale, float offset)

Route a control source node (output) to a destination mode (input)

Return

True is successful, false if not

Parameters
  • src: The source node (should be an output)

  • dest: The destination node (should be an input)

  • [in] scale: The scale to apply to the control value

  • [in] offset: The offset to apply to the control value

void add_bypass_button(FOOTSWITCH footswitch)

Set one of the footswitches to be a bypass button.

This function will also set the corresponding LED to turn on and off when bypass is disabled / enabled.

Parameters
  • [in] footswitch: The footswitch (FOOTSWITCH_RIGHT, FOOTSWITCH_LEFT)

void add_tap_interval_button(FOOTSWITCH footswitch, bool enable_led_flash)

Set one of the footswitches to be a tap tempo / length button.

Parameters
  • [in] footswitch: The footswitch (FOOTSWITCH_RIGHT, FOOTSWITCH_LEFT, FOOTSWITCH_BOTH)

  • [in] enable_led_flash: Set the corresponding LED to flash at tempo rate

void bypass_fx(void)
void enable_fx(void)
bool new_tap_interval(void)

Returns true when a new tap interval has been tapped in by the user.

Return

{ description_of_the_return_value }

float get_tap_interval_ms(void)

Returns the current tap interval in milliseconds.

Return

The tap interval in milliseconds.

float get_tap_freq_hz(void)

Returns the current tap interval in Hertz (cycles / second)

Return

The tap frequency in Hertz

Sets the LED blink rate for tap interval.

Use this if there is a pot that can also change the tempo / rate / duration to override what has been previously “tapped” in.

Parameters
  • [in] rate_hz: The new blink rate in Hertz

Sets the LED blink rate for tap interval with LED control.

Use this if there is a pot that can also change the tempo / rate / duration to override what has been previously “tapped” in.

Parameters
  • [in] rate_hz: The new blink rate in Hertz

  • [in] led: Which LED to flash (FOOTSWITCH_LEFT, FOOTSWITCH_RIGHT)

Sets the LED blink rate in milliseconds.

Use this if there is a pot that can also change the tempo / rate / duration to override what has been previously “tapped” in.

Parameters
  • [in] ms: The blink rate in milliseconds

Sets the LED blink rate for tap interval with LED control.

Use this if there is a pot that can also change the tempo / rate / duration to override what has been previously “tapped” in.

Parameters
  • [in] ms: The new blink period in milliseconds

  • [in] led: Which LED to flash (FOOTSWITCH_LEFT, FOOTSWITCH_RIGHT)

bool button_pressed(FOOTSWITCH footswitch, bool enable_led)

Checks if a button was just pressed and optionally turns on an LED when it is.

This function is used to create events when a button is held down and released to momentarily enable / disable functionality.

Return

true if button is pressed, false if not

Parameters
  • [in] footswitch: The footswitch (FOOTSWITCH_LEFT, FOOTSWITCH_RIGHT, (FOOTSWITCH_LEFT, FOOTSWITCH_BOTH)

  • [in] enable_led: If true, lights LED while button pressed

bool button_released(FOOTSWITCH footswitch, bool enable_led)

Checks if a button was just released and optionally turns off an LED when it was.

This function is used to create events when a button is held down and released to momentarily enable / disable functionality.

Return

{ description_of_the_return_value }

Parameters
  • [in] footswitch: The footswitch (FOOTSWITCH_LEFT, FOOTSWITCH_RIGHT, (FOOTSWITCH_LEFT, FOOTSWITCH_BOTH)

  • [in] enable_led: If true, turns off the LED when button is released

void register_tap(void)
void button_press_check(void)
void service_button_events(void)
void print_instance_stack(void)

Utility function to print the instance stack to the console.

void print_routing_table(void)

Utility function to print the routing table to the console.

void print_param_tables(void)

Utility function to print the parameter tables.

void print_processor_load(int seconds)

Prints the current processor loading (percentage) to Serial console.

Parameters
  • [in] seconds: How many seconds to wait before displaying the loading again

void spi_transmit_param(EFFECT_TYPE instance_type, uint32_t instance_id, PARAM_TYPES param_type, uint8_t param_id, void *value)
void parameter_service(void)

Public Members

bool bypass_control_enabled
bool bypassed
FOOTSWITCH bypass_footswitch
bool tap_control_enabled
FOOTSWITCH tap_footswitch
fx_pot pot_right
fx_pot pot_center
fx_pot pot_left
fx_led led_left
fx_led led_right
fx_pot pot_top_left
fx_pot pot_top_right
fx_pot pot_bot_left
fx_pot pot_bot_center
fx_pot pot_bot_right
fx_pot exp_pedal
fx_switch toggle_left
fx_switch toggle_right
fx_led led_center
fx_audio_node *instr_in

Alias for left instrument in (mono)

fx_audio_node *instr_in_l

Left instrument in node

fx_audio_node *instr_in_r

Right instrument in node

fx_audio_node *amp_out

Alias for left instrument out (mono)

fx_audio_node *amp_out_l

Left amp out node

fx_audio_node *amp_out_r

Right amp out node

fx_audio_node *mic_in_l
fx_audio_node *mic_in_r
fx_control_node *note_frequency

Pedal variable of current note frequency

fx_control_node *note_duration

Pedal variable of current note duration in milliseconds

fx_control_node *new_note

Pedal variable of when a new note is played

Protected Attributes

fx_audio_node *audio_node_stack[4]
fx_control_node *control_node_stack[4]

Friends

friend fx_pedal::fx_effect