Loading...
Searching...
No Matches
CommonWidgets.hpp
1#pragma once
2#include <ossia/detail/enum_map.hpp>
3
4#include <array>
5namespace Control::Widgets
6{
7static const constexpr std::array<std::pair<const char*, float>, 14> durations{
8 {{"Inf", -1.},
9 {"Whole", 1.},
10 {"Half", 1. / 2.},
11 {"4th", 1. / 4.},
12 {"8th", 1. / 8.},
13 {"16th", 1. / 16.},
14 {"32th", 1. / 32.},
15 {"64th", 1. / 64.},
16 {"Dotted Half", 3. / 4.},
17 {"Dotted 4th", 3. / 8.},
18 {"Dotted 8th", 3. / 16.},
19 {"Dotted 16th", 3. / 32.},
20 {"Dotted 32th", 3. / 64.},
21 {"None", 0.}}};
22static const constexpr std::array<std::pair<const char*, float>, 13> notes{
23 {{"None", 0.},
24 {"Whole", 1.},
25 {"Half", 1. / 2.},
26 {"4th", 1. / 4.},
27 {"8th", 1. / 8.},
28 {"16th", 1. / 16.},
29 {"32th", 1. / 32.},
30 {"64th", 1. / 64.},
31 {"Dotted Half", 3. / 4.},
32 {"Dotted 4th", 3. / 8.},
33 {"Dotted 8th", 3. / 16.},
34 {"Dotted 16th", 3. / 32.},
35 {"Dotted 32th", 3. / 64.}}};
36
37static const constexpr std::array<std::pair<const char*, float>, 12> nonnull_notes{
38 {{"Whole", 1.},
39 {"Half", 1. / 2.},
40 {"4th", 1. / 4.},
41 {"8th", 1. / 8.},
42 {"16th", 1. / 16.},
43 {"32th", 1. / 32.},
44 {"64th", 1. / 64.},
45 {"Dotted Half", 3. / 4.},
46 {"Dotted 4th", 3. / 8.},
47 {"Dotted 8th", 3. / 16.},
48 {"Dotted 16th", 3. / 32.},
49 {"Dotted 32th", 3. / 64.}}};
50
51static const constexpr std::array<std::pair<const char*, int>, 5> arpeggios{
52 {{"Forward", 0}, {"Backward", 1}, {"F->B", 2}, {"B->F", 3}, {"Chord", 4}}};
53
54enum Waveform
55{
56 Sin,
57 Triangle,
58 Saw,
59 Square,
60 SampleAndHold,
61 Noise1,
62 Noise2,
63 Noise3
64};
65
66#if 0
67static constexpr auto WaveformChooser()
68{
69 return Control::make_enum(
70 "Waveform", 0U,
71 ossia::make_array(
72 "Sin", "Triangle", "Saw", "Square", "Sample & Hold", "Noise 1", "Noise 2",
73 "Noise 3"),
74 std::array<const char*, 16>{
75 ":/icons/wave_sin_off.png", ":/icons/wave_sin_on.png",
76 ":/icons/wave_triangle_off.png", ":/icons/wave_triangle_on.png",
77 ":/icons/wave_saw_off.png", ":/icons/wave_saw_on.png",
78 ":/icons/wave_square_off.png", ":/icons/wave_square_on.png",
79 ":/icons/wave_sample_and_hold_off.png", ":/icons/wave_sample_and_hold_on.png",
80 ":/icons/wave_noise1_off.png", ":/icons/wave_noise1_on.png",
81 ":/icons/wave_noise2_off.png", ":/icons/wave_noise2_on.png",
82 ":/icons/wave_noise3_off.png", ":/icons/wave_noise3_on.png"});
83}
84
85#endif
86}