MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / MakeVibratoTable

Method MakeVibratoTable

Source/FamiTrackerModule.cpp:170–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170std::array<int, 256> CFamiTrackerModule::MakeVibratoTable() const { // // //
171 const double NEW_VIBRATO_DEPTH[] = {
172 0.0, 1.5, 2.5, 4.0, 5.0, 7.0, 10.0, 12.0, 14.0, 17.0, 22.0, 30.0, 44.0, 64.0, 96.0, 128.0,
173 };
174
175 const double OLD_VIBRATO_DEPTH[] = {
176 0.0, 1.0, 2.0, 3.0, 4.0, 7.0, 8.0, 15.0, 16.0, 31.0, 32.0, 63.0, 64.0, 127.0, 128.0, 255.0,
177 };
178
179 std::array<int, 256> table = { };
180 const double PI = std::acos(-1);
181
182 for (int depth = 0; depth < 16; ++depth) {
183 for (int phase = 0; phase < 16; ++phase) {
184 auto t = (double)phase;
185 table[depth * 16 + phase] = (int)(GetVibratoStyle() == vibrato_t::Bidir ?
186 (std::sin(t * PI / 32.) * NEW_VIBRATO_DEPTH[depth] /*+ .5*/) :
187 (t * OLD_VIBRATO_DEPTH[depth] / 16. + 1.));
188 }
189 }
190
191 return table;
192}
193
194CPeriodTables CFamiTrackerModule::MakePeriodTables() const { // // //
195 CPeriodTables table;

Callers 2

LoadDriverMethod · 0.80
SetupVibratoMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected