deltabeard / Peanut-GB

A Game Boy (DMG) emulator single header library written in C99. Performance is prioritised over accuracy.
https://projects.deltabeard.com/peanutgb/
329 stars 41 forks source link

apu: replace internal samples buffer with one given by SDL audio callback #41

Closed deltabeard closed 5 years ago

deltabeard commented 5 years ago

SDL2 provides an allocated buffer with its length to the audio callback function. Therefore, peanut_apu does not require any internal buffer. The buffer and the size of which should be passed to the functions called by audio_update(), where the SDL2 buffer replaces "samples" and the length of the buffer replaces "nsamples".

I hope to remove all memory allocation functions and things like memmove() too.

deltabeard commented 5 years ago

9de157aedcea42d408bae7a51b8d639b5893c534