Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 18, 2011 10:16:36 GMT -5
So I was looking for ways to play WAV files as sound effects along side of Shiru's TFD Replayer, and I stumbled upon Mairtrus's WAV playback code: PlaySEGA: poke &hA04000,&h2B ' DAC enable register while peek(&hA04000).7 ' wait for busy wend poke &hA04001,&h80 ' the DAC is enabled now poke &hA04002,&hB6 ' set mode while peek(&hA04000).7 ' wait for busy wend poke &hA04003,&hC0 ' DAC is stereo now poke &hA04000,&h2A ' adress of the PCM info reload PCMData for a=1 to #PCMLongitude while peek(&hA04000).7 'wait for busy wend read Wave poke &hA04001, Wave ' put the data into the YMH2612 halt ' small delay next a return PCMData: DATAFILE segapcm.bin,BIN where #PCMLongitude is the real longitude of the SEEEEGAAAAA sound in bytes. When using this routine, it halts everything while this code executes. How would this be run along side of Shiru's TFD replayer to use as a quick sound effect? I know next to nothing about music programming or the z80, so any help would be greatly appreciated! Thanks
|
|
|
Post by Mairtrus on Sept 19, 2011 9:23:56 GMT -5
That's because this routine plays the whole PCM at once, without waiting the rest of the code for being executed. You can solve it by playing a few waves each frame:
... If PCMLongitude>0 then for I=1 to 8 while peek(&hA04000).7 'wait for busy wend read Wave poke &hA04001, Wave ' put the data into the YMH2612 halt ' small delay next I end if or something like that. The problem is that, usually, there will be no enough free time to make the pcm sounds 'continuous'. That's the reason why some games (i.e.: Sonic 1) uses the Z80 for the pcm playback...
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 19, 2011 9:43:11 GMT -5
Well the sound clips that will be in WAV format will be less than 1 second long, so that *shouldn't* be too much of an issue, but I get what you're saying. I will try to fool around with it a little bit when I get home.
Is there any docs that you have links to for z80 programming so I can attempt to convert this over to the z80? I'm sure it's going to be way over my head, but I'll figure something out.
Also, one other question, which has to do with the reload statement: If the TFM driver is using the Reload TFDFile, and this Wave player uses Reload PCMFile, will it screw things up? I'm not entirely sure how reload works - whether it can load more than 1 thing at a time, or if it overwrites the previous reloaded data.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 19, 2011 10:00:53 GMT -5
The RELOAD / RESTORE command simply sets the data pointer used by the READ commands .. with the READ commands automatically incrementing the data pointer value / address.
|
|