APU savestate restore?

APU savestate restore?
by on (#175185)
In my emulator, a few games produce a stalled sound when a savestate is restored. After a quick check, I noticed that active time left counters (ATL, $40xF regs) must be zero on reload. It fixes the problem, but is this correct?
Re: APU savestate restore?
by on (#175196)
Clearing the timers would just silence a sound in progress, wouldn't it? If you aren't, then the correct solution may be to include the APU state fully in your savestates, and restore the timers based on that.
Re: APU savestate restore?
by on (#175201)
mikejmoffitt wrote:
Clearing the timers would just silence a sound in progress, wouldn't it? If you aren't, then the correct solution may be to include the APU state fully in your savestates, and restore the timers based on that.

No and nope. :|
My emulator already saves the complete APU state & restores it. Just to make crystal clear - if there's a music playing and I restore a savestate, there is a big chance of squares & noise channels to continue playing. The solution is clearing the current ATL values, ignoring the saved ones. I wonder if this is correct...
Re: APU savestate restore?
by on (#175202)
If squares and noise were playing when you saved the state, you want them to resume playing in the same manner when you reload the state.
Re: APU savestate restore?
by on (#175203)
tepples wrote:
If squares and noise were playing when you saved the state, you want them to resume playing in the same manner when you reload the state.

If squares and noise were not playing when you saved the state, you want them to continue silenced in the same manner when you reload the state, no matter if they're currently playing before a state loading.
Re: APU savestate restore?
by on (#175204)
Then your saving or restoration of something in the channels' state is broken.