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

Function GetPitchText

Source/RegisterDisplay.cpp:50–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50CStringA GetPitchText(int digits, int period, double freq) {
51 const LPCSTR fmt = "pitch = $%0*X (%7.2fHz %s %+03i)";
52 const double note = NoteFromFreq(freq);
53 const int note_conv = note >= 0 ? int(note + 0.5) : int(note - 0.5);
54 const int cents = int((note - double(note_conv)) * 100.0);
55
56 if (freq != 0.)
57 return FormattedA(fmt, digits, period, freq, GetNoteString(ft0cc::doc::pitch_from_midi(note_conv), ft0cc::doc::oct_from_midi(note_conv) + 1).data(), cents);
58 return FormattedA(fmt, digits, period, 0., "---", 0);
59};
60
61} // namespace
62

Callers 1

DrawMethod · 0.85

Calls 6

NoteFromFreqFunction · 0.85
FormattedAFunction · 0.85
GetNoteStringFunction · 0.85
pitch_from_midiFunction · 0.85
oct_from_midiFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected