Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void OPM_DoLFO(ym2151_t *chip)
- {
- // LFO timer 1
- if ((chip->cycles & 0x0f) == 0x0c)
- {
- chip->lfo_timer1++;
- }
- chip->lfo_timer1_overflow <<= 1;
- chip->lfo_timer1_overflow |= chip->lfo_timer1 >> 4;
- chip->lfo_timer1 &= 0x0f;
- // LFO timer 2
- chip->lfo_timer2 += ((chip->lfo_timer1_overflow >> 2) & 0x01) | chip->mode_test[3];
- chip->lfo_timer2_reset <<= 1;
- chip->lfo_timer2_reset |= chip->lfo_timer2 >> 15;
- chip->lfo_counter_inc <<= 1;
- chip->lfo_counter_inc |= (chip->lfo_timer2 >> 15) | chip->lfo_counter_inc1 | chip->mode_test[2];
- if ((chip->cycles & 0x0f) == 0x0e)
- {
- chip->lfo_timer2_overflow |= chip->lfo_timer2 >> 15;
- }
- chip->lfo_timer2 &= 0x7fff;
- if (chip->lfo_timer2_reset & 0x04)
- {
- chip->lfo_timer2 = 0x8000 - (1 << chip->lfo_freq_hi);
- }
- }
- void OPM_DoLFO2(ym2151_t *chip)
- {
- chip->lfo_counter_inc1 = 0;
- // LFO timer 3
- if ((chip->cycles & 0x0f) == 0x05)
- {
- chip->lfo_timer2_overflow <<= 1;
- }
- if ((chip->cycles & 0x0f) == 0x0d && (chip->lfo_timer2_overflow & 0x02) != 0)
- {
- if (((chip->lfo_timer3 & 0x01) == 0x00 && (chip->lfo_freq_lo & 0x01) != 0)
- || ((chip->lfo_timer3 & 0x03) == 0x01 && (chip->lfo_freq_lo & 0x02) != 0)
- || ((chip->lfo_timer3 & 0x07) == 0x03 && (chip->lfo_freq_lo & 0x04) != 0)
- || ((chip->lfo_timer3 & 0x0f) == 0x07 && (chip->lfo_freq_lo & 0x08) != 0))
- {
- chip->lfo_counter_inc1 = 1;
- }
- chip->lfo_timer3++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement