This topic is now archived and is closed to further replies.


Audio Experts please - discussion with a view to DS

Recommended Posts

I am trying to work out what the optimal program and data flow design might be for an audio streaming system of encoded data. My current implementation, using DirectSound, uses notification positions within the streaming buffer to call a buffer update function every so often. At each buffer update call, my program does this: * Check status of an in-buffer (for holding encoded data). Fill it up to full if it needs it. * Decode as much as we can of the in-buffer into an out-buffer (holds decoded data)... an optimisation might be to decode straight into the streaming buffer but it caused crackling last time I tried it. * Move any unused input encoded data to the beginning of the input buffer. * Repeat, leaving any unused encoded data in the in-buffer for next time. This system I've implemented works fine, and does not crackle, however I've noticed on machines with Creative sound cards and VIA chipsets that it can often skip under heavy load (i.e. lots of other apps running and so on). Although this is primarily a driver fault, WinAmp is good enough not to cause crackling or skipping on such machines... AFAIK, Winamp checks its buffer status at fixed time intervals (obviously not DS dependent), but it manages to keep an extremely low CPU usage for playing a standard mp3 file. A bare-bones sample program that I have written which plays the same mp3 file (using windows ACM to decode) has very strange CPU usage: it uses ~1% for roughly 1.5s, then about 20% in a short period, then back to 1% again, and repeats... This is most likely due to periodic buffer fills and mem copies. Can anybody help me find some ways to possibly improve my streaming system to use less CPU time? At least a more constant CPU usage rather than 20% jolts would be a good improvement... I would very much appreciate any replies, as this is a rather difficult subject which not many seem to have experience in. I would be extremely grateful to anybody who can assist. Thanks for your time, ======== Smidge ======== [edited by - smidge_tech on July 27, 2002 1:59:20 PM]

Share this post

Link to post
Share on other sites