Debian Codegraph @

BambooTracker/gui/effect_description.cpp

raw
1 /*
2 * Copyright (C) 2019-2022 Rerrah
3 *
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use,
8 * copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following
11 * conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26 #include "effect_description.hpp"
27 #include <unordered_map>
28 #include <QCoreApplication>
29 #include "enum_hash.hpp"
30
31 namespace effect_desc
32 {
33 namespace
34 {
35 struct EffectDetail
36 {
37 const QString format;
38 const char* desc;
39 };
40
41 const std::unordered_map<EffectType, EffectDetail> DETAILS = {
42 { EffectType::Arpeggio, { "00xy", QT_TRANSLATE_NOOP("EffectDescription", "Arpeggio, x: 2nd note (0-F), y: 3rd note (0-F)") } },
43 { EffectType::PortamentoUp, { "01xx", QT_TRANSLATE_NOOP("EffectDescription", "Portamento up, xx: depth (00-FF)") } },
44 { EffectType::PortamentoDown, { "02xx", QT_TRANSLATE_NOOP("EffectDescription", "Portamento down, xx: depth (00-FF)") } },
45 { EffectType::TonePortamento, { "03xx", QT_TRANSLATE_NOOP("EffectDescription", "Tone portamento, xx: depth (00-FF)") } },
46 { EffectType::Vibrato, { "04xy", QT_TRANSLATE_NOOP("EffectDescription", "Vibrato, x: period (0-F), y: depth (0-F)") } },
47 { EffectType::Tremolo, { "07xx", QT_TRANSLATE_NOOP("EffectDescription", "Tremolo, x: period (0-F), y: depth (0-F)") } },
48 { EffectType::Pan, { "08xx", QT_TRANSLATE_NOOP("EffectDescription", "Pan, xx: 00 = no sound, 01 = right, 02 = left, 03 = center") } },
49 { EffectType::VolumeSlide, { "0Axy", QT_TRANSLATE_NOOP("EffectDescription", "Volume slide, x: up (0-F), y: down (0-F)") } },
50 { EffectType::PositionJump, { "0Bxx", QT_TRANSLATE_NOOP("EffectDescription", "Jump to beginning of order xx") } },
51 { EffectType::SongEnd, { "0Cxx", QT_TRANSLATE_NOOP("EffectDescription", "End of song") } },
52 { EffectType::PatternBreak, { "0Dxx", QT_TRANSLATE_NOOP("EffectDescription", "Jump to step xx of next order") } },
53 { EffectType::SpeedTempoChange, { "0Fxx", QT_TRANSLATE_NOOP("EffectDescription", "Change speed (xx: 00-1F), change tempo (xx: 20-FF)") } },
54 { EffectType::NoteDelay, { "0Gxx", QT_TRANSLATE_NOOP("EffectDescription", "Note delay, xx: count (00-FF)") } },
55 { EffectType::AutoEnvelope, { "0Hxy", QT_TRANSLATE_NOOP("EffectDescription", "Auto envelope, x: shift amount (0-F), y: shape (0-F)") } },
56 { EffectType::HardEnvHighPeriod, { "0Ixx", QT_TRANSLATE_NOOP("EffectDescription", "Hardware envelope period 1, xx: high byte (00-FF)") } },
57 { EffectType::HardEnvLowPeriod, { "0Jxx", QT_TRANSLATE_NOOP("EffectDescription", "Hardware envelope period 2, xx: low byte (00-FF)") } },
58 { EffectType::Retrigger, { "0Kxy", QT_TRANSLATE_NOOP("EffectDescription", "Retrigger, x: volume slide (0-7: up, 8-F: down), y: tick (1-F)") } },
59 { EffectType::Groove, { "0Oxx", QT_TRANSLATE_NOOP("EffectDescription", "Set groove xx") } },
60 { EffectType::Detune, { "0Pxx", QT_TRANSLATE_NOOP("EffectDescription", "Detune, xx: pitch (00-FF)") } },
61 { EffectType::NoteSlideUp, { "0Qxy", QT_TRANSLATE_NOOP("EffectDescription", "Note slide up, x: count (0-F), y: semitone (0-F)") } },
62 { EffectType::NoteSlideDown, { "0Rxy", QT_TRANSLATE_NOOP("EffectDescription", "Note slide down, x: count (0-F), y: semitone (0-F)") } },
63 { EffectType::NoteRelease, { "0Sxx", QT_TRANSLATE_NOOP("EffectDescription", "Note release, xx: count (00-FF)") } },
64 { EffectType::TransposeDelay, { "0Txy", QT_TRANSLATE_NOOP("EffectDescription", "Transpose delay, x: count (0-7: up, 8-F: down), y: semitone (0-F)") } },
65 { EffectType::ToneNoiseMix, { "0Vxx", QT_TRANSLATE_NOOP("EffectDescription", "Tone/Noise mix, xx: 00 = no sound, 01 = tone, 02 = noise, 03 = tone & noise") } },
66 { EffectType::MasterVolume, { "0Vxx", QT_TRANSLATE_NOOP("EffectDescription", "Master volume, xx: volume (00-3F)") } },
67 { EffectType::NoisePitch, { "0Wxx", QT_TRANSLATE_NOOP("EffectDescription", "Noise pitch, xx: pitch (00-1F)") } },
68 { EffectType::RegisterAddress0, { "0Xxx", QT_TRANSLATE_NOOP("EffectDescription", "Register address bank 0, xx: address (00-6B)") } },
69 { EffectType::RegisterAddress1, { "0Yxx", QT_TRANSLATE_NOOP("EffectDescription", "Register address bank 1, xx: address (00-6B)") } },
70 { EffectType::RegisterValue, { "0Zxx", QT_TRANSLATE_NOOP("EffectDescription", "Register value set, xx: value (00-FF)") } },
71 { EffectType::ARControl, { "Axyy", QT_TRANSLATE_NOOP("EffectDescription", "AR control, x: operator (1-4), yy: attack rate (00-1F)") } },
72 { EffectType::Brightness, { "B0xx", QT_TRANSLATE_NOOP("EffectDescription", "Brightness, xx: relative value (01-FF)") } },
73 { EffectType::DRControl, { "Dxyy", QT_TRANSLATE_NOOP("EffectDescription", "DR control, x: operator (1-4), yy: decay rate (00-1F)") } },
74 { EffectType::XVolumeSlide, { "EAxy", QT_TRANSLATE_NOOP("EffectDescription", "Extended volume slide, x: up (0-F), y: down (0-F)") } },
75 { EffectType::NoteCut, { "ESxx", QT_TRANSLATE_NOOP("EffectDescription", "Note cut, xx: count (00-FF)") } },
76 { EffectType::FBControl, { "FBxx", QT_TRANSLATE_NOOP("EffectDescription", "FB control, xx: feedback value (00-07)") } },
77 { EffectType::FineDetune, { "FPxx", QT_TRANSLATE_NOOP("EffectDescription", "Fine detune, xx: pitch (00-FF)") } },
78 { EffectType::MLControl, { "MLxy", QT_TRANSLATE_NOOP("EffectDescription", "ML control, x: operator (1-4), y: multiple (0-F)") } },
79 { EffectType::VolumeDelay, { "Mxyy", QT_TRANSLATE_NOOP("EffectDescription", "Volume delay, x: count (0-F), yy: volume (00-FF)") } },
80 { EffectType::RRControl, { "RRxy", QT_TRANSLATE_NOOP("EffectDescription", "RR control, x: operator (1-4), y: release rate (0-F)") } },
81 { EffectType::TLControl, { "Txyy", QT_TRANSLATE_NOOP("EffectDescription", "TL control, x: operator (1-4), yy: total level (00-7F)") } },
82 { EffectType::NoEffect, { "", QT_TRANSLATE_NOOP("EffectDescription", "Invalid effect") } }
83 };
84 }
85
86 QString getEffectFormat(const EffectType type)
87 {
88 return DETAILS.at(type).format;
89 }
90 QString getEffectDescription(const EffectType type)
91 {
92 return QCoreApplication::translate("EffectDescription", DETAILS.at(type).desc);
93 }
94
95 QString getEffectFormatAndDetailString(const EffectType type)
96 {
97 if (type == EffectType::NoEffect) {
98 return getEffectDescription(EffectType::NoEffect);
99 }
100 else {
101 return getEffectFormat(type) + " - " + getEffectDescription(type);
102 }
103 }
104 }