LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

PCM with ring buffer not working

Root / Programming Questions / [.]

hakkeCreated:
I was trying to setup a ring buffer to get data from a source buffer to play in PCMSTREAM, but as the buffer gets to ¾ of the source, RINGCOPY errors signaling the copy source length. Could anyone see my (barebones) code, and tell me what's wrong with it? Thanks in advance. Key: CK2KQ3HS

I realized why it doesn't work: RINGCOPY treats the destination as a ring buffer, not the source. I don't know why I thought it was the other way, but it actually took me a while to get it. EDIT: I fixed it by making a RINGCOPY function which does treat the source as a ring buffer aswell. Key: EBL4CEME

If the sample loops a lot of times it might be faster to use ARYOP, like DIM DEST[1000] DIM SRC[10] ARYOP #AOPADD,DEST,SRC,0 and now DEST will be filled with 100 copies of SRC, and you can RINGCOPY that to the PCMSTREAM array But I haven't checked to see if it's faster than just doing a bunch of COPYs EDIT: or if you know the sample is never going to repeat more than a certain number of times, you can just make an array with the sample repeated that many times, and ringcopy from that

Well, the first method works, but it will obviously waste a lot of memory, as well as the second one, combined with the fact that they won't work with what I'm aiming to achieve (real-time PCM)
Spoileri obviously dont want to make an organya music player
. It's really cool that ARYOP does that though, never thought of it (hehe)