| Mozzi version v1.1.0 sound synthesis library for Arduino |

Public Member Functions | Protected Attributes | List of all members
EventDelay Class Reference

A non-blocking replacement for Arduino's delay() function. More...

`#include <EventDelay.h>`

Inheritance diagram for EventDelay:

## Public Member Functions
| EventDelay (unsigned int delay_milliseconds=0)
| Constructor. More...
void | set (unsigned int delay_milliseconds)
| Set the delay time. More...
void | start ()
| Start the delay. More...
void | start (unsigned int delay_milliseconds)
| Set the delay time and start the delay. More...
bool | ready ()
| Call this in updateControl() or updateAudio() to check if the delay time is up. More...

## Protected Attributes
unsigned long | deadline
unsigned long | ticks

## Detailed Description

A non-blocking replacement for Arduino's delay() function.

EventDelay can be set() to a number of milliseconds, then after calling start(), ready() will return true when the time is up.
Alternatively, start(milliseconds) will call set() and start() together.

Definition at line 20 of file EventDelay.h.

## Constructor & Destructor Documentation

## ◆ EventDelay()

EventDelay::EventDelay | ( | unsigned int | delay_milliseconds = `0` | ) |
| inline

Constructor.

Declare an EventDelay object.

Parameters

  delay_milliseconds | how long until ready() returns true, after calling start(). Defaults to 0 if no parameter is supplied.

Definition at line 29 of file EventDelay.h.

## Member Function Documentation

## ◆ ready()

bool EventDelay::ready | ( |  | ) |
| inline

Call this in updateControl() or updateAudio() to check if the delay time is up.

Returns
  true if the time is up.

Note
  timing: 1us.

Definition at line 73 of file EventDelay.h.

## ◆ set()

void EventDelay::set | ( | unsigned int | delay_milliseconds | ) |
| inline

Set the delay time.

This setting is persistent, until you change it by using set() again.

Parameters

  delay_milliseconds | delay time in milliseconds.

Note
  timing: 12us

Definition at line 40 of file EventDelay.h.

## ◆ start() [1/2]

void EventDelay::start | ( |  | ) |
| inline

Start the delay.

Definition at line 51 of file EventDelay.h.

## ◆ start() [2/2]

void EventDelay::start | ( | unsigned int | delay_milliseconds | ) |
| inline

Set the delay time and start the delay.

Parameters

  delay_milliseconds | delay time in milliseconds.

Definition at line 61 of file EventDelay.h.