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

Method GetPitch

Source/ChannelHandler.cpp:102–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102int CChannelHandler::GetPitch() const
103{
104 if (m_iPitch != 0 && m_iNote != -1 && !m_iNoteLookupTable.empty()) {
105 // Interpolate pitch
106 int LowNote = std::clamp(m_iNote - PITCH_WHEEL_RANGE, 0, NOTE_COUNT - 1); // // //
107 int HighNote = std::clamp(m_iNote + PITCH_WHEEL_RANGE, 0, NOTE_COUNT - 1);
108 int Freq = m_iNoteLookupTable[m_iNote];
109 int Lower = m_iNoteLookupTable[LowNote];
110 int Higher = m_iNoteLookupTable[HighNote];
111 int Pitch = (m_iPitch < 0) ? (Freq - Lower) : (Higher - Freq);
112 return (Pitch * m_iPitch) / 511;
113 }
114
115 return 0;
116}
117
118void CChannelHandler::Arpeggiate(unsigned int Note)
119{

Callers 1

UpdateChannelsMethod · 0.45

Calls 2

clampFunction · 0.85
emptyMethod · 0.80

Tested by

no test coverage detected