datajerk / c2t

Retro Code (Apple II, Cosmac VIP) to Tape/Text
BSD 3-Clause "New" or "Revised" License
64 stars 11 forks source link

Refactor appendtone signature #6

Closed raphlinus closed 6 years ago

raphlinus commented 6 years ago

Creates an "outbuf" struct with all the state needed for rendering pulses into an audio buffer. Calls to appendtone take a pointer to this struct instead of four separate args.

This patch shouldn't affect behavior at all. It is a step toward providing band-limited waveform generation (see #4).

Also uses doubling approach to reallocate audio buffer, one of the existing todo items.

raphlinus commented 6 years ago

Note that I'm patching the source but not redoing executables. I'm flexible how to handle that, perhaps develop in a branch that doesn't have executables and then "master" is the latest release?

I'm about to do band-limited waveform generation using the existing encoding. Discussion question: do you want that to be an option? In my opinion it is strictly better than the existing square approach (or the sine approach in c2t), but that said it's different so arguably requires testing.

datajerk commented 6 years ago

I can build the artifacts, so do not worry about that. re: band-limited waveform generation, can it be optional while in test? Getting a volume of testers will take time as well.

raphlinus commented 6 years ago

Yeah, band-limited generation needs to be optional, the single load binary tests are passing, while the dsk ones are failing with chksum error (in the emulator; haven't tried on a real machine yet). I think I'll focus on using it for my own encoding.

datajerk commented 6 years ago

Which emulator? I tested your 23k wav with Virtual ][ and it failed. I will not be able to test on physical HW for a few days. My lab was flooded and I have not recovered yet.

raphlinus commented 6 years ago

Playing with this some more, I think trying these advanced waveforms in emulators is destined to fail, as the emulator would have to model band-limited reconstruction and also properties of the 741. I'm also using Virtual ][. I've tried on an actual IIe but am also having problems. The square waveforms of c2t-96h don't work as well as -8 on c2t, so it's hard for me to tell whether band-limited waveforms are making things better or worse.

My current plan is to redo the encoding with an eye for reliability. I think I know how to do it, stay tuned.

datajerk commented 6 years ago

You may want to also try openemulator (https://github.com/OpenEmulatorProject/OpenEmulator-OSX). Apple II+ supported. Open Source, perhaps it can be made to be more accurate.