#include <xtd/collections/generic/list>
#include <xtd/threading/thread>
#include <xtd/as>
#include <xtd/beep>
#include <xtd/console>
 
 
enum class tone {
  rest = 0,
  g_below_c = 196,
  a_sharp = 233,
  c_sharp = 277,
  d_sharp = 311,
  f_sharp = 370,
  g_sharp = 415,
};
 
enum class duration {
  whole = 1600,
  half = whole / 2,
  quarter = half / 2,
  eighth = quarter / 2,
  sixteenth = eighth / 2,
};
 
struct note final {
private:
  tone tone_val = tone::rest;
  duration dur_val = duration::none;
  
public:
  
  note(tone frequency, duration time) : tone_val(frequency), dur_val(time) {}
  
  note() = default;
  note(const note& note) = default;
  note& operator=(const note& note) = default;
  bool operator ==(const note& rhs) const noexcept {return tone_val == rhs.tone_val && dur_val == rhs.dur_val;}
 
  
  tone note_tone() const noexcept {return tone_val;}
  duration note_duration() const noexcept {return dur_val;}
};
 
    if (
n.note_tone() == tone::rest)
 
    else
      console::out << beep(as<unsigned int>(
n.note_tone()), as<unsigned int>(
n.note_duration()));
 
  }
}
 
auto main() -> int {
  
    note(tone::b, duration::quarter),
    note(tone::a, duration::quarter),
    note(tone::g_below_c, duration::quarter),
    note(tone::a, duration::quarter),
    note(tone::b, duration::quarter),
    note(tone::b, duration::quarter),
    note(tone::b, duration::half),
    note(tone::a, duration::quarter),
    note(tone::a, duration::quarter),
    note(tone::a, duration::half),
    note(tone::b, duration::quarter),
    note(tone::d, duration::quarter),
    note(tone::d, duration::half)
  };
  
}
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:71
 
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:15