DPortAudio
Andrej Mitrovic
andrej.mitrovich at gmail.com
Wed Jul 20 12:18:56 PDT 2011
I've fixed the performance issue with the wave player example. Instead
of constantly redrawing a large amount of data (it would max out my
single core), I've employed a caching technique.
Basically, the waveform only needs to be redrawn when the window size
changes. So I hold two buffers, one for the waveform, the other for
the playback indicator. The first one is rarely updated, while for the
second one I first do a /blit/ of the cached bitmap from buffer 1 to
buffer 2, and then draw the playback indicator over buffer 2.
I can't directly draw the indicator over buffer 1 because that would
overwrite the cached image.
This is all described in the source code btw.
Now the CPU usage is a clean 0%, and the GUI is much more responsive! :)
More information about the Digitalmars-d-announce
mailing list