How Windows Audio Works :- Direct Sound and WASAPI

Posted: December 4, 2012 in Audio, DTS Master, HTPC, True HD

Windows is the most widely used operating system in the world . people use it for verities of task  and listening audio is one of them . Microsoft windows 7 and above can render sound in two ways . using Directx’s direct sound support and using WASAPI support. most of the windows applications use Directsound approach . windows can play multiple stream from different applications when its using direct sound . Directsound works as a middle layer between application software and sound drivers . It takes sound from different application software and then resample all sound stream to one stream and then sends it to audio drivers .  the downside of this approach is that , we never get what we actually play . for e.g.. if some one is playing a sound file at 192 Khz, 24 bit . then windows will probably resample it into 44kHz, 16 Bit with other sound on machine. but on the plus side it provide a unified framework to developers to create application that can utilize windows audio without directly programming sound card. Direct sound automatically resample sound stream to matching sample rate that can be supported by audio hardware.

  On the other hand , windows 7 also provide WASAPI mode. by using WASAPI mode , application can ask for  exclusive access of sound card and can directly send stream to Sound card . In this case, application have to handle all the re-sampling if the sample rate of played audio is not supported by sound card . WASAPI provide two modes to work with . shared mode and exclusive mode . shared mode works same as direct sound and windows audio mixer do the re-sampling and mixing . in exclusive mode  WASAPI bypass windows audio mixer and application can directly send data to sound card. in this mode, application can decode the formats like DTS,DTS master audio , DOLBY True HD, Dolby digital, Flac etc and send the unaltered stream to audio card.

Also addition to different modes , its also important that how WASAPI manage data between buffers . WASAPI use PUSH and PULL approach to ask for data which needs to be processed. in push approach application pushes the data to buffers and continuously monitor it and as soon as it sees it empted out , it fill it again . in PULL approach, which is a modern technique, application use two buffers . the audio divers gives a call to application as soon as it sees the empty buffer and it start using data from other buffer . in meantime applications fills the empty buffer.

  many application software support WASAPI and DirectX. XBMC, Foober2000 and Winamp (with plugin only) are few popular options if someone wants to give it a try … :)

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s