dirkwhoffmann / virtualc64

VirtualC64 is a cycle-accurate C64 emulator for macOS
https://dirkwhoffmann.github.io/virtualc64
Other
342 stars 33 forks source link

Proposed API change in Muxer class #789

Closed dirkwhoffmann closed 1 month ago

dirkwhoffmann commented 4 months ago

As one of the main entry points, the Muxer class provides function

void executeUntil(Cycle targetCycle);

which runs SID to the specified target cycle and produces some sound samples on its way.

Things would become easier (e.g., the screen recorder implementation) if this function took the number of expected sound samples as an argument. In the screen recorder case, SID will have to produce 882 samples per frame for a sampling frequency of 44100Hz. The current implementation produces between 881 and 883, as the number is derived from the target cycle. This makes the current code error-prone to buffer underflows.

dirkwhoffmann commented 1 month ago

After thinking about this approach a second time, I don't consider it beneficial anymore. For example, all register writes had to be remembered and replayed during sample synthesis (like in vAmiga).