![]() |
| | #1 |
| Registered User Join Date: Aug 2001 Location: Newport, South Wales, UK
Posts: 1,094
| 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 | |
| | #2 | |
| Super Moderator Join Date: Aug 2001
Posts: 7,472
| Quote:
__________________ If you aim at everything you will hit something but you won't know what it is. | |
| Bubba is offline | |
| | #3 |
| Rampaging 35 Stone Welsh 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 | |
| | #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 | |
![]() |
| Thread Tools | |
| Display Modes | |
|
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 |