Reset FM synthesis and PCM state on load
This commit is contained in:
parent
c188aafb22
commit
ba59bb8028
4 changed files with 16 additions and 1 deletions
|
@ -82,6 +82,14 @@ class ym2151_interface : public ymfm::ymfm_interface {
|
|||
bool irq() {
|
||||
return m_irq_status;
|
||||
}
|
||||
void reset() {
|
||||
m_chip.reset();
|
||||
m_timers[0] = 0;
|
||||
m_timers[1] = 0;
|
||||
m_busy_timer = 0;
|
||||
m_irq_status = false;
|
||||
opm_out.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
ymfm::ym2151 m_chip;
|
||||
|
@ -114,6 +122,9 @@ extern "C" {
|
|||
void YM_write_reg(uint8_t reg, uint8_t val) {
|
||||
if (initialized) opm_iface.write(reg, val);
|
||||
}
|
||||
void YM_reset() {
|
||||
opm_iface.reset();
|
||||
}
|
||||
|
||||
uint8_t YM_read_status() {
|
||||
if (initialized)
|
||||
|
|
|
@ -12,7 +12,7 @@ extern "C" {
|
|||
void YM_stream_update(int16_t* output, uint32_t numsamples);
|
||||
void YM_write_reg(uint8_t reg, uint8_t val);
|
||||
bool YM_irq(void);
|
||||
|
||||
void YM_reset();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -74,7 +74,9 @@ extern SDL_AudioSpec obtained;
|
|||
void ZsmBackend::switch_stream(int idx) {
|
||||
YM_Create(YM_FREQ);
|
||||
YM_init(YM_FREQ/64, 60);
|
||||
YM_reset();
|
||||
psg_reset();
|
||||
pcm_reset();
|
||||
for (uint8_t i = 0; i < 16; i++) {
|
||||
psg_writereg(i * 4 + 2, 0);
|
||||
}
|
||||
|
|
|
@ -68,6 +68,8 @@ class ZsmBackend : public PlaybackBackend {
|
|||
DynPtr out_buf;
|
||||
DynPtr ym_buf;
|
||||
DynPtr ym_resample_buf;
|
||||
bool ym_recorded = false;
|
||||
uint8_t ym_data[256];
|
||||
uint32_t loop_rem;
|
||||
uint32_t pcm_data_offs;
|
||||
uint32_t loop;
|
||||
|
|
Loading…
Reference in a new issue