/////////////////////////////////////////////////////////////////////////// // // DetectAdLib() - Determines if there's an AdLib (or SoundBlaster // emulating an AdLib) present // /////////////////////////////////////////////////////////////////////////// void COPLEmulator::StartOPLforAdlibSound() { for (int i = 1; i <= 0xf5; i++) // Zero all the registers Chip__WriteReg( i, 0); Chip__WriteReg( 1, 0x20); // Set WSE=1 // alOut(8, 0); // Set CSM=0 & SEL=0 Chip__WriteReg( alEffects, 0); AlSetFXInst(m_alZeroInst); }
static void WriteRegister(unsigned int reg_num, unsigned int value) { switch (reg_num) { case OPL_REG_TIMER1: timer1.value = value; OPLTimer_CalculateEndTime(&timer1); break; case OPL_REG_TIMER2: timer2.value = value; OPLTimer_CalculateEndTime(&timer2); break; case OPL_REG_TIMER_CTRL: if (value & 0x80) { timer1.enabled = 0; timer2.enabled = 0; } else { if ((value & 0x40) == 0) { timer1.enabled = (value & 0x01) != 0; OPLTimer_CalculateEndTime(&timer1); } if ((value & 0x20) == 0) { timer1.enabled = (value & 0x02) != 0; OPLTimer_CalculateEndTime(&timer2); } } break; default: Chip__WriteReg(&opl_chip, reg_num, value); break; } }
static inline void YM3812Write(Chip *which, Bit32u reg, Bit8u val) { Chip__WriteReg(which, reg, val); }
/////////////////////////////////////////////////////////////////////////// // // ShutAL() - Shuts down the AdLib card for sound effects // /////////////////////////////////////////////////////////////////////////// void COPLEmulator::ShutAL() { Chip__WriteReg( alEffects, 0); Chip__WriteReg( alFreqH + 0,0); AlSetFXInst(m_alZeroInst); }
/////////////////////////////////////////////////////////////////////////// // // SDL_ALStopSound() - Turns off any sound effects playing through the // AdLib card // /////////////////////////////////////////////////////////////////////////// void COPLEmulator::ALStopSound() { Chip__WriteReg( alFreqH + 0, 0); }
void COPLEmulator::AlSetFXInst(Instrument &inst) { byte c,m; m = 0; // modulator cell for channel 0 c = 3; // carrier cell for channel 0 Chip__WriteReg( m + alChar, inst.mChar); Chip__WriteReg( m + alScale,inst.mScale); Chip__WriteReg( m + alAttack,inst.mAttack); Chip__WriteReg( m + alSus,inst.mSus); Chip__WriteReg( m + alWave,inst.mWave); Chip__WriteReg( c + alChar,inst.cChar); Chip__WriteReg( c + alScale,inst.cScale); Chip__WriteReg( c + alAttack,inst.cAttack); Chip__WriteReg( c + alSus,inst.cSus); Chip__WriteReg( c + alWave,inst.cWave); Chip__WriteReg( alFeedCon, 0); }
void COPLEmulator::shutdown() { Chip__WriteReg( alEffects,0); for (int i = 1; i < 0xf5; i++) Chip__WriteReg( i, 0); }