dirkwhoffmann / vAmiga

vAmiga is a user-friendly Amiga 500, 1000, 2000 emulator for macOS
https://dirkwhoffmann.github.io/vAmiga
Other
293 stars 24 forks source link

Accelerate the audio backend if no sound is playing #814

Open dirkwhoffmann opened 5 months ago

dirkwhoffmann commented 5 months ago

Idea: The following condition should reliably detect whether sound is playing:

no_sound =
paula.muxer.sampler[0].count() == 1 &&
paula.muxer.sampler[1].count() == 1 &&
paula.muxer.sampler[2].count() == 1 &&
paula.muxer.sampler[3].count() == 1

Proposal:

  1. If no sound is playing, skip the sample synthesis part and prolong the sample buffer with the last written value (don't write zeroes!).

  2. Do the same in warp mode. In this case, filling in zeroes is OK as the volume gets faded to 0 when warp mode activates.

dirkwhoffmann commented 5 months ago

The audio fast path works as expected. However, the speed gain is minimal. The emulator only runs about 0.5 MHz faster in warp mode on the MacBook Pro (Kick 1.3, hand&disk symbol showing).