mackron / miniaudio

Audio playback and capture library written in C, in a single source file.
https://miniaud.io
Other
4.07k stars 361 forks source link

FR: ability to process less than available frameCount frames #367

Closed actondev closed 3 years ago

actondev commented 3 years ago

In my application I'm using libpd (embedded puredata) and I want to use miniaudio for the audio in/out. Puredata is configured to process chunks of 64 frames at a time (in puredata lingo this is called ticks).

As it is, in my dataCallback I'm writing frameCount - frameCount%/64 frames, resulting in bad audio (under pulseaudio)

As I see it this situation could be solved be either

mackron commented 3 years ago

This can already be done by implementing your own caching layer above the data callback. The fixed_sized_buffer example will allow you to process audio data in fixed sizes (defined by a compile-time constant).

actondev commented 3 years ago

Thanks for the pointer! Had missed this.