Drag
Member
I've created a software synthesizer. So obviously, the synthesizer will stream its output to a buffer which is outputted (as opposed to playing wav files).
Now, I use SDL to get audio because that way I won't have to fool around with directsound, and besides, I intend to use this in my GP32 games.
My problem is that I have no idea what to do. SDL calls my function automatically whenever it needs to fill a buffer up. SDL will pass the amount of bytes I need to fill, and a pointer to the buffer that I need to fill. The function calls the synthesizer's render function, then writes the output to the buffer, increases the pointer, and then loops until all of the requested bytes are filled.
So I guess what I need is a ringbuffer, and an IRQ to tell me when I need to write to the ringbuffer. I use Mr.Mirko's SDK, so is there something in there that I can use?
Now, I use SDL to get audio because that way I won't have to fool around with directsound, and besides, I intend to use this in my GP32 games.
My problem is that I have no idea what to do. SDL calls my function automatically whenever it needs to fill a buffer up. SDL will pass the amount of bytes I need to fill, and a pointer to the buffer that I need to fill. The function calls the synthesizer's render function, then writes the output to the buffer, increases the pointer, and then loops until all of the requested bytes are filled.
So I guess what I need is a ringbuffer, and an IRQ to tell me when I need to write to the ringbuffer. I use Mr.Mirko's SDK, so is there something in there that I can use?