Closed tehKaiN closed 5 years ago
There is a nice lib which does everything I need atm: http://eab.abime.net/showthread.php?t=65430
the list goes on. It's in asm and there's C header.
When targeting other targets, perhaps we can just rewrite it into more portable C code.
aminet link: http://aminet.net/package/mus/play/ptplayer
There's still room for enhancement here. If the sound manager's music routine writes Paula registers with the Copper, there's no further need for CIA timers OR VBlank interrupts. Just count the rows of pixels rendered and have the Copper write to the Paula registers. Once the current audio frame is written to the Copper list, trigger a callback hook to refresh the blocks with the Paula writes in them and update the y position based on 15 KHz horizontal sync (or pairs of them if scan doubled on AGA) and spool the block back into the queue. (There are a few corner cases with oversized blocks and having to skip over the vertical blank region but will work on a fast CPU without having to worry about the '060 screwing things up.)
I don't like idea of using copper for it, since it would imply collisions with other stuff on copperlist and also, there's additional DMA penalty:
So I think vblank/cia is a way to go.
On a side note, I've tried to use ptplayer but failed miserably. ACE tends to re-enable and disable OS during game loadings and ptplayer's int/dma state doesn't get preserved correctly since it doesn't use ACE's systemSetInt
and systemSetDma
. Thus rewrite to C and tweak for ACE is needed.
The original ProTracker 2.3d player won't work on an '060 or '080 because it depends on a delay being triggered by a multiply (I think) and on the '060+ that only takes one clock cycle. The typical workaround is to route the register accesses through the Copper as I had proposed so that the delay can be implemented with a CWait.
To summarize discussion we had on slack, I'll paste the conclusion here:
I guess it should be up to user to choose implementation because some games are copper-intensive, some are not I think for now there's a need for at least one ptplayer implementation, then when second one arrives their interface could be unified and they can be selected by
#ifdef
So I guess the first implementation in C gets incorporated into ACE, then we can add additional ones if there will be a need to do things differently.
Basic audio management works quite reliably, so any future development regarding MOD replaying should go into separate issue. Let's merge it asap because those commits are getting rebased over and over again, waiting for no one knows what.
also, master is not building because it relies on audio stuff now, so let's fix it by merging asap
ACE is under development since 2013 and needs some form of outputting sound! After having that done, another issue will be made about making it better and more versatile.
Basic audio output is here: https://github.com/weiju/amiga-stuff/blob/master/hardware/soundfx.c