Thread: Is waveOut... Still So Slow?

  1. #1
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273

    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?

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    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.

  3. #3
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    waveout is fine if you just need standard audio, DirectSound is necessary if you want to do 3d sound for systems like 5.1

  4. #4
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273
    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...

Popular pages Recent additions subscribe to a feed

Similar Threads

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