FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
This struct is the unit data manipulated by TonePlayer
: it describes one Tone
along with its duration in milliseconds.
More...
#include <fastarduino/devices/tone_player.h>
Public Member Functions | |
TonePlay ()=default | |
Default constructor, used only to declare an uninitialized TonePlay variable. More... | |
constexpr | TonePlay (Tone tone, Duration duration) |
Construct a tone play with the provided tone and duration. More... | |
constexpr | TonePlay (Tone tone, uint8_t value=0) |
Construct a "special" tone play with the provided value. More... | |
Friends | |
template<board::Timer , board::PWMPin , typename > | |
class | AbstractTonePlayer |
This struct is the unit data manipulated by TonePlayer
: it describes one Tone
along with its duration in milliseconds.
It can also hold special tones as defined in SpecialTone
namespace.
Note that, although it is quite easy to define melodies with TonePlay
, it is less efficient in terms of code size and performance (this is due to the need to convert tone frequencies to Timer prescaler and counter). It is advised, to use TonePlayer::QTonePlay
optimized structure instead.
Definition at line 161 of file tone_player.h.
|
default |
Default constructor, used only to declare an uninitialized TonePlay
variable.
You should always ensure you replace such a variable with one constructed with the next constructor.
Construct a tone play with the provided tone and duration.
tone | the Tone for this TonePlay ; it will be automatically converted (at compile-time if t is a constant) to the proper timer prescaler and counter. |
duration | the duration of this note. |
Definition at line 186 of file tone_player.h.
|
inlineconstexpr |
Construct a "special" tone play with the provided value.
tone | the special tone (as defined in SpecialTone namespace) |
value | additional value which meaning depends on actual tone: number of repeats for SpecialTone::REPEAT_END , number of ties or slurs between successive notes for SpecialTone::TIE . |
Definition at line 196 of file tone_player.h.
|
friend |
Definition at line 250 of file tone_player.h.
Duration devices::audio::TonePlay::duration_ |
Definition at line 245 of file tone_player.h.
uint8_t devices::audio::TonePlay::repeats_ |
Definition at line 246 of file tone_player.h.
uint8_t devices::audio::TonePlay::ties_ |
Definition at line 247 of file tone_player.h.