C Board  

Go Back   C Board > General Programming Boards > Game Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-20-2009, 12:41 PM   #1
Registered User
 
Join Date: Aug 2001
Location: Newport, South Wales, UK
Posts: 1,094
Question Is waveOut... Still So Slow?

Hello,

Just a quick question really... I know that since Vista, Microsoft has considered hardware acceleration of audio to be deprecated. The reasoning behind this was presumably that a modern CPU could cope with mixing and effects while doing everything else at the same time.

Testing this hypothesis, I've recently tried to write a simple software audio mixer that can mix together up to 8 sounds of varying lengths. I tried doing this with ten 100ms buffers and found that it is laggy as hell(?)

Much like other code designs, the mixer runs in its own thread and waits on two event objects, one coming from the waveOut device and one from the creating thread indicating when it would like to play another sound.

Initial testing seems to indicate that the mechanism works fine, the buffers just aren't long enough to compensate for the time it takes to mix each individual sample. But 100ms?

I've seen an official sample that Microsoft provides which demonstrates a software mixer DLL. The core elements of it are written in assembly language.

I know that for operations like this you can take advantage of MMX or SIMD to process blocks of data more efficiently than using code a C/C++ compiler might initially generate, but is it still really that high-latency interface of legend, even on a modern computer?

Yes, I know I could use DirectSound, but look at how fast GDI goes these days. Why is the standard audio interface still so dodgy?
SMurf is offline   Reply With Quote
Old 10-20-2009, 07:53 PM   #2
Super Moderator
 
Bubba's Avatar
 
Join Date: Aug 2001
Posts: 7,472
Quote:
The reasoning behind this was presumably that a modern CPU could cope with mixing and effects while doing everything else at the same time.
Actually I believe the primary reason was that most of the 'send to Microsoft' dialogs that people responded to were related somehow to the audio acceleration layer. That combined with the fact that you mentioned concerning CPU power probably put the final nail in the coffin. IMO it was a bad idea but then again no one asked me.
__________________
If you aim at everything you will hit something but you won't know what it is.
Bubba is offline   Reply With Quote
Old 10-21-2009, 12:46 AM   #3
Rampaging 35 Stone Welsh
 
abachler's Avatar
 
Join Date: Apr 2007
Posts: 2,927
waveout is fine if you just need standard audio, DirectSound is necessary if you want to do 3d sound for systems like 5.1
__________________
He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet
abachler is offline   Reply With Quote
Old 10-21-2009, 10:07 AM   #4
Registered User
 
Join Date: Aug 2001
Location: Newport, South Wales, UK
Posts: 1,094
On second thought... I might be misunderstanding the flags in the WAVEHDR structure and starving my own thread. That'll teach me not to do more testing...
SMurf is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is virtual calls really slow or it is just bull........? idleman C++ Programming 41 09-28-2009 11:51 AM
slow typing ad highlighting axon Tech Board 10 01-13-2004 08:27 PM
slow game lambs4 Game Programming 2 08-21-2003 02:08 PM
Solutions for slow performance? Hunter2 Game Programming 52 08-24-2002 10:04 AM
slow load of Cprog.com Generator A Brief History of Cprogramming.com 12 10-13-2001 06:31 AM


All times are GMT -6. The time now is 06:30 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22