5 #ifndef __MELODY_HEADER
6 #define __MELODY_HEADER
14 template<
typename pin_concept>
17 melody_class(): t_start_(0), current_note_(1), rep_(false), unit_dur_(250), cutoff_(10) {
30 current_note_ = notes.size() + 1;
39 for(uint8_t
i = 0;
i < notes_.
size(); ++
i) {
40 pin_.tone(notes_[
i], dur_[i] * unit_dur_ - cutoff_);
41 delay(dur_[i] * unit_dur_);
49 if(notes_.
size() == 0)
55 pin_.tone(notes_[current_note_], dur_[current_note_] * unit_dur_ - cutoff_);
58 if(current_note_ > notes_.
size())
60 if(current_note_ == notes_.
size()) {
68 if(
tool::clock.millis() - t_start_ >= dur_[current_note_] * unit_dur_) {
70 if(current_note_ == notes_.
size())
73 pin_.tone(notes_[current_note_], dur_[current_note_] * unit_dur_ - cutoff_);
79 uint8_t current_note_;
90 #endif //__MELODY_HEADER
constexpr size_type size() const noexcept
Definition: initializer_list.hpp:36
size_type const & size() const
Definition: vector.hpp:110
void push_back(T const &in)
Definition: vector.hpp:50
initializer_list
Definition: initializer_list.hpp:12
void clear()
Definition: vector.hpp:68
#define ASSERT(exp)
Definition: ard_assert.hpp:33