Mozzi  alpha 0.01.1t
sound synthesis library for Arduino
 All Classes Functions Typedefs
Public Member Functions
EventDelay< UPDATE_RATE > Class Template Reference

A non-blocking replacement for Arduino's delay() function (which is disabled by Mozzi). More...

List of all members.

Public Member Functions

 EventDelay ()
 Constructor.
void set (unsigned int delay_milliseconds)
 Set the delay time.
void start ()
 Start the delay.
void start (unsigned int delay_milliseconds)
 Set the delay time and start the delay.
bool ready ()
 Call this in updateControl() or updateAudio() to check if the delay time is up.

Detailed Description

template<unsigned int UPDATE_RATE>
class EventDelay< UPDATE_RATE >

A non-blocking replacement for Arduino's delay() function (which is disabled by Mozzi).

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

Template Parameters:
update_rateis how frequently you'll check if the EventDelay is ready(). This would be CONTROL_RATE if ready() is used simply in updateControl().

Definition at line 33 of file EventDelay.h.


Constructor & Destructor Documentation

template<unsigned int UPDATE_RATE>
EventDelay< UPDATE_RATE >::EventDelay ( ) [inline]

Constructor.

Declare an EventDelay object with UPDATE_RATE template parameter. UPDATE_RATE is how frequently you'll check if the EventDelay is ready(). This would be CONTROL_RATE if ready() is used simply in updateControl().

Definition at line 42 of file EventDelay.h.


Member Function Documentation

template<unsigned int UPDATE_RATE>
bool EventDelay< UPDATE_RATE >::ready ( ) [inline]

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

Returns:
true if the time is up.

Definition at line 84 of file EventDelay.h.

template<unsigned int UPDATE_RATE>
void EventDelay< UPDATE_RATE >::set ( unsigned int  delay_milliseconds) [inline]

Set the delay time.

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

Parameters:
delay_millisecondsdelay time in milliseconds.

Definition at line 52 of file EventDelay.h.

template<unsigned int UPDATE_RATE>
void EventDelay< UPDATE_RATE >::start ( ) [inline]

Start the delay.

Todo:
have a parameter to set whether it's single or repeating, so start doesn't have to be called for repeats. Pro: simpler user programming. Con: would require an if..then every time ready() is called.

Definition at line 63 of file EventDelay.h.

template<unsigned int UPDATE_RATE>
void EventDelay< UPDATE_RATE >::start ( unsigned int  delay_milliseconds) [inline]

Set the delay time and start the delay.

Parameters:
delay_millisecondsdelay time in milliseconds.

Definition at line 73 of file EventDelay.h.


The documentation for this class was generated from the following file: