Skip to content
This repository has been archived by the owner on Oct 16, 2021. It is now read-only.

5B noise period overwritten

nyanpasu64 edited this page Jul 2, 2018 · 2 revisions
// New Notes
void CChannelHandlerS5B::HandleNote(int Note, int Octave)   	 // // //
{
    CChannelHandler::HandleNote(Note, Octave);
    m_iNoiseFreq = m_iDefaultNoise; // BUG! Wxx written on *every new note*
}

Solution

  • All effect IDs are remapped from Vxx.
if (this->m_iDefaultDuty & DutyType::NOISE) {
	m_iNoiseFreq = m_iDefaultNoise;
}

m_iDefaultDuty (Vxx) vs m_iDutyPeriod (Vxx plus instrument bit-flags)?

  • The second is wrong. If m_iDutyPeriod is used, Wxx (note) checks m_iDutyPeriod (instrument sequence) before the latter is updated. This is bad; it means if a tone is played after noise, Wxx will be applied for 1 frame as noise switches to tone. This can overwrite noise instruments starting that frame, in leftward 5B channels.

Notes: https://docs.google.com/document/d/e/2PACX-1vQ8osh6mm4c4Ay_gVMIJCH8eRB5gBE180Xyeda1T5U6owG7BbKM-yNKVB8azg27HUD9QZ9Vf88crplE/pub