#include <xtd/xtd>
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
};
using note = std::tuple<tone, duration>;
auto play(auto&& tone, auto&& duration) {console::beep(as<uint32>(tone), as<uint32>(duration));}
auto play(
auto&& note) {std::apply([](
auto&&... args) {
play(
args...);}, note);}
auto play(
auto&&... tune) {(
play(tune), ...);}
auto main() -> int {
play(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});
}
constexpr auto args()
Generates a set of positional placeholders that can be decomposed using structured bindings to build ...
Definition args.hpp:43
@ none
No modifier key.
Definition console_modifiers.hpp:22
@ a
The A key.
Definition console_key.hpp:88
@ c
The C key.
Definition console_key.hpp:92
@ d
The D key.
Definition console_key.hpp:94
@ f
The F key.
Definition console_key.hpp:98
@ b
The B key.
Definition console_key.hpp:90
@ play
The Play key.
Definition console_key.hpp:302
@ g
The G key.
Definition console_key.hpp:100
@ e
The E key.
Definition console_key.hpp:96