randyrossi / bmc64

A bare metal Commodore 64 emulator for the Raspberry Pi with true 50hz/60hz smooth scrolling, low input latency and better audio/video sync.
GNU General Public License v3.0
479 stars 56 forks source link

Feature request: Enable playback sound of TAP files #165

Open Eddepad opened 3 years ago

Eddepad commented 3 years ago

Since Vice 3.5 there is an option to enable sound from TAP files (I have it enabled in the Windows version). When I had my first C64 back in the 80's, I had a 3d party datasette with a volume button. I mainly used it to locate blank spaces on the tape for the beginning of a next program, or where I could add one. But because I heard that sound from the tape so often, it would be great if that could be implemented in BMC64 if possible. Maybe in the "Tape" section of the menu or at the Prefs near the "Drive Sound Emulation". Thanks,

rhester72 commented 3 years ago

Had a first play with this, but it didn't go very well. Somehow my integration into the menu system causes the entire kernel to lock up on start, and (apparently clean) integration of the relevant upstream VICE code also hangs the emulator the moment the tape starts trying to produce sound.

The relevant VICE source check-in was here:

https://sourceforge.net/p/vice-emu/code/37951/

There's clearly something going on in the sound code that depends on further upstream changes to function as expected, but I don't have time to look deeper to figure out what it is. Porting those changes in (plus the requisite changes to menu.c, menu.h, emux_api.h and the BMC64 Makefiles) results in a clean compile but will crash quickly.

Debugging bare metal code against upstream projects is not my forte, unfortunately. If anyone wants to see my messy diffs that will get them as far as I did (read: not very far), feel free to inquire, but it's literally only about 20 minutes of work to port all this in yourself directly from upstream.

I did take datasette-sound.c and datasette-sound.h directly from upstream HEAD versus the above-referenced VICE snapshot, but didn't see anything that changed after that seemed material, so I don't think this was a matter of early buggy implementation that was later fixed upstream. Something else fundamental changed in the VICE sound handler between 3.3 and 3.5 that makes this messy.