Order of the Butterfly
Posts: 462 from 2003/2/25
You can setup a decoding task that feeds a buffer at maximum pace (using left cpu cycles). Setup another task for playing that just grab samples from that buffer.
Less demanding part in the demo will allows the buffer to fully fill while more demanding part of the demo will make the buffer deplete.
The decoding task can be run at -1 pri and it will just grab whatever is left CPU wise without hurting other tasks.
My SoundBankster2 (unreleased) DJing application is using such buffer scheme. I managed a perfectly smooth subpixel scrolling at VBL framerate without tearing while decoding mp3 with 100% cpu usage.
This trick requires a custom Reggae class for the buffer which I can provide if needed.[ Edited by Tcheko 09.11.2022 - 07:13 ]