Y8950* y8950Create(Mixer* mixer) { Y8950* y8950; y8950 = (Y8950*)calloc(1, sizeof(Y8950)); y8950->mixer = mixer; y8950->timerRunning1 = 0; y8950->timerRunning2 = 0; y8950->timer1 = boardTimerCreate(onTimeout1, y8950); y8950->timer2 = boardTimerCreate(onTimeout2, y8950); y8950->ykIo = ykIoCreate(); y8950->handle = mixerRegisterChannel(mixer, MIXER_CHANNEL_MSXAUDIO, 0, y8950Sync, y8950SetSampleRate, y8950); y8950->opl = OPLCreate(OPL_TYPE_Y8950, FREQUENCY, SAMPLERATE, 256, y8950); OPLSetOversampling(y8950->opl, boardGetY8950Oversampling()); OPLResetChip(y8950->opl); y8950->rate = mixerGetSampleRate(mixer); return y8950; }
void y8950Reset(Y8950* y8950) { y8950TimerStart(y8950, 0, 0); y8950TimerStart(y8950, 1, 0); OPLResetChip(y8950->opl); y8950->off = 0; y8950->s1 = 0; y8950->s2 = 0; }