void CVRC6Sawtooth::RefreshChannel() { unsigned int Period = CalculatePeriod(); unsigned char HiFreq = (Period & 0xFF); unsigned char LoFreq = (Period >> 8); unsigned int TremVol = GetTremolo(); int Volume = (m_iSeqVolume * (m_iVolume >> VOL_COLUMN_SHIFT)) / 15 - TremVol; Volume = (Volume << 1) | ((m_iDutyPeriod & 1) << 5); if (Volume < 0) Volume = 0; if (Volume > 63) Volume = 63; if (m_iSeqVolume > 0 && m_iVolume > 0 && Volume == 0) Volume = 2; if (!m_bGate) Volume = 0; if (!m_bGate || !Volume) { WriteExternalRegister(0xB002, 0x00); return; } WriteExternalRegister(0xB000, Volume); WriteExternalRegister(0xB001, HiFreq); WriteExternalRegister(0xB002, 0x80 | LoFreq); }
void CVRC6Sawtooth::RefreshChannel() { if (!m_bEnabled) return; unsigned int Period = CalculatePeriod(false); unsigned char HiFreq = (Period & 0xFF); unsigned char LoFreq = (Period >> 8); unsigned int TremVol = GetTremolo(); unsigned int Volume = (m_iSeqVolume * (m_iVolume >> VOL_SHIFT)) / 15 - TremVol; Volume = (Volume << 1) | ((m_iDutyPeriod & 1) << 5); if (Volume > 63) Volume = 63; if (m_iSeqVolume > 0 && m_iVolume > 0 && Volume == 0) Volume = 1; m_pAPU->ExternalWrite(0xB000, Volume); m_pAPU->ExternalWrite(0xB001, HiFreq); m_pAPU->ExternalWrite(0xB002, 0x80 | LoFreq); }
void CVRC6Square2::RefreshChannel() { if (!m_bEnabled) return; unsigned int Period = CalculatePeriod(false); unsigned int Volume = CalculateVolume(15); unsigned char DutyCycle = m_iDutyPeriod << 4; unsigned char HiFreq = (Period & 0xFF); unsigned char LoFreq = (Period >> 8); m_pAPU->ExternalWrite(0xA000, DutyCycle | Volume); m_pAPU->ExternalWrite(0xA001, HiFreq); m_pAPU->ExternalWrite(0xA002, 0x80 | LoFreq); }
void CVRC6Square2::RefreshChannel() { unsigned int Period = CalculatePeriod(); unsigned int Volume = CalculateVolume(); unsigned char DutyCycle = m_iDutyPeriod << 4; unsigned char HiFreq = (Period & 0xFF); unsigned char LoFreq = (Period >> 8); if (!m_bGate || !Volume) { WriteExternalRegister(0xA002, 0x00); return; } WriteExternalRegister(0xA000, DutyCycle | Volume); WriteExternalRegister(0xA001, HiFreq); WriteExternalRegister(0xA002, 0x80 | LoFreq); }
void CProject::ImprovePeriod(DataMode mode) { UpdatePEData(); // check if we have got enough points if (GetSelectedPoints()==0) { InformUser(DIALOG_PERIOD_NOT_ENOUGH_POINTS);return; } // make a calculate first CalculatePeriod(mode); // now do an improve // store the selection Period.StoreSelection(); // select all frequencies, amplitudes and phases Period.SelectAll(); // calculate GeneralCalcPeriod(mode); // and restore selection Period.RestoreSelection(); // and update all displays UpdatePEDisplays(); }
void CMMC5Square2Chan::RefreshChannel() { if (!m_bEnabled) return; int Period = CalculatePeriod(false); int Volume = CalculateVolume(15); char DutyCycle = (m_iDutyPeriod & 0x03); unsigned char HiFreq = (Period & 0xFF); unsigned char LoFreq = (Period >> 8); unsigned char LastLoFreq = (m_iLastPeriod >> 8); m_iLastPeriod = Period; WriteExternalRegister(0x5015, 0x03); WriteExternalRegister(0x5004, (DutyCycle << 6) | 0x30 | Volume); WriteExternalRegister(0x5006, HiFreq); if (LoFreq != LastLoFreq) WriteExternalRegister(0x5007, LoFreq); }