superpete wrote:
still getting my head around how the existing ports handle sound, they seem to be doing they're own queueing with TheSoundBuff..?
The basic idea is a ring buffer that the platform independent code writes to, and the platform dependent code reads. The platform dependent code also adjusts how fast the emulation runs, adding or removing a tick every second, so as to keep the sound buffer filled to the desired amount, to keep latency as small as possible while avoiding buffer under run.
In Mini vMac 3.0.4, which Zydeco's iPhone port is based on, the platform independent code requests a 370 byte sound buffer every tick from the platform dependent code. Since the ring buffer size is not a multiple of 370, this requires a hack, where the platform independent code actually writes past the end of the ring buffer, and the platform dependent code copies the excess to the beginning of the buffer.
In Mini vMac 3.2.3, this hack is not needed. The platform independent code requests space, and is told how much contiguous space is actually available. If it needs to write more than that, it is responsible for breaking up the write into two parts.
In Mini vMac 3.2.3, the platform independent sound code also requests space in smaller chunks instead of a whole ticks worth of 370 bytes at a time. This would permit lower latency, at the discretion of the platform dependent code.
superpete wrote:
Other than drive sounds and the settings window, I'm not sure what you could strip out of the port and have it still functional under iOS.
Perhaps so. As I said, I'm not very familiar with the iOS port. Since these days "Mini" is not referring to the complete source code, just the binaries, I guess I could just include the entire iOS port in my version of the source, if I get to understand it well enough.
One question I have, is it really necessary to have that many separate source files? For the other ports, there is basically one source file per port. I guess the convention in Objective C is to have each class in its own file. How strong is that convention?
Another question, how hard would it be to hack the iOS port to more or less run in Mac OS X? Having that to start from would make it much easier for me to get going with learning Cocoa and Objective C. So if someone did that hack, I would credit them for making the Mac Cocoa port of Mini vMac, even if I still needed to do a lot work to polish it. It's clear that a Cocoa port is going to be needed in the near future of the Mac.