Audio in Windows Vista

Audio in Windows Vista
原帖地址:
http://forums.creative.com/creativelabs/board/message?board.id=Vista&message.id=1694

这个是一堆老外对这个帖子的讨论:
http://forums.creative.com/creativelabs/board/message?board.id=Vista&message.id=2204

这个是OpenAL 在"吹牛" ,哈哈,有空看看,估计是贬低别人,抬高自己:
http://www.openal.org/openal_vista.html


查到这篇文章是因为在gameres上看到这篇文章:

Vista将支持Creative EAX效果

 最近网上谣传Vista中将不再支持很多当前的音频技术。据说是因为驱动模型的变化,Microsft去掉了音频硬件层,而只支持OpenAL音频模型。当然,这意味着过去的DirectSound 3D和EAX将很少有用武之地。

 

这显然使过去买了Creative价值昂贵的可编程声卡的用户感到失望,由于DirectX 10的限制,在没有使用OpenAL的游戏中, DirectX 10将把所有的复杂音频处理任务交还给CPU,这将显著降低音频质量和性能。用户购买Creative声卡的初衷就是为了欣赏高质量的音频体验,而Vista的出现将让他们的投资化为乌有,这肯定不是用户,包括Creative希望看到的结果。

幸好,Creative日前告诉Custom PC杂志说,他们正在开发X-FI声卡的Vista驱动,可以允许在所有的游戏中实现完全的硬件音频处理,而不仅仅是使用OpenAL的游戏中。这个驱动可以截获游戏对DirectSound 3D的调用,并将之实时转化为OPenAL,之后再把调用指令送达到 DirectX 10 API,通过将调用转化为OPenAL,Creative得以突破Windows Vista的限制。

Creative表示该驱动预计在Vista发布前一个月,也就是12月完成,该驱动将支持所有Creative X-Fi声卡。但是,老的Audigy和Sound Blaster声卡初步将不会支持,这意味着在Vista系统中,获得
高质量音频的唯一方法就是购买X-Fi声卡。

hmm,Audigy声卡将被Vista和Creative抛弃了...也许这是Creative促销X-Fi声卡的一种方法?或者说是Microsoft和Creative共同的策略?


-----------------------------------------------------------------------------
此文重点:
 1.都放弃DirectSound改学OpenAL吧!
 2.都去买Creative Sound Blaster X-Fi 吧!

别以为这是小事,3D音效可是超级费CPU的!

文章正式开始:

Hi everyone,

兄弟姐妹们,
        As this covers a lot of information, I have split it into 3 posts, so please make sure to read all 3 posts before 
responding.

         这鸟玩意儿涵盖了太多的信息,老子把它分成了3份,所以你们在回复之前请确认阅读了所有的3篇帖子。 

Summary:
概述

 

         In this article, we would like to address questions and concerns raised by customers regarding compatibility of Creative audio products with Windows Vista.

 

In general, issues relating to Creative audio products may be divided  into one of four categories:

 

1.       The Windows Vista audio engine runs faster than the Windows XP audio engine did, and Vista has tighter requirements on audio buffer position accuracy than XP did. This exposed low level driver bugs that we had not been seen before.

Issues that may be encountered:
Audio dropouts, distortions that only happen once in a while, constant distortions, or audio/video synchronization drift that only happens after several hours of watching movies.
Status:

We are working daily to address issues in this category, and we have recently published “beta” drivers for Vista for some of our products that address these. Please don’t hesitate to contact us if you find our latest beta drivers continue to exhibit symptoms such as those described

2.       The Vista audio architecture changes the way per-stream audio processing works, which required us to write new software to support this

Issues that may be encountered:
CMSS no longer works on audio streams from the OS.
Status:
Features based on Windows XP architecture must be rewritten to conform to the new Vista architecture, and we have a team of software engineers, project managers and testers dedicated to this task in order to provide our customers the same seamless audio experience under Windows Vista that they enjoyed under Windows XP.

3.       The Vista audio architecture disables DirectSound 3D hardware acceleration; resulting in legacy DirectSound based EAX game titles not working as they did in XP.

Issues that may be encountered:

Could range from loss of EAX functionality in EAX enabled games to a complete game incompatibility, depending on how the game title was authored. This would only happen with games that render 3D audio using DirectSound, it should not affect games that render 3D audio using OpenAL.

(Note: There is a known bug due to a change to Vista which confuses an OpenAL component. A proper fix in progress, but a workaround is to copy c:\windows\system32\ct_oal.dll into the doom3 folder and rename it to OpenAL32.dll)


Status:
These issues cannot be addressed by the Creative audio driver, because the functionality was purposely removed by the operating system. We look forward to game titles moving away from DirectSound and toward OpenAL for fully optimized Creative 3D audio hardware and technology support.

4.       Bugs in Vista.

Issues that may be encountered:
Vista itself is still in the final stages of testing, and is not yet at code-freeze. Also, the user mode audio stack is nearly 100% brand new software. As a result, there are indeed issues whose root cause is in the operating system.
Status:
We are working closely with Microsoft to alert them of any and all issues like this, and we have found them to be cooperative with us in bringing them to resolution.

 
 

Details:

The purpose of this article is to explain the changes to how audio is handled under Windows Vista, and how we are planning to address this

 

What level of compatibility exists between XP and Vista drivers?

Default Driver Model: WDM

As with Windows NT, Windows 2000 and Windows XP, the foundation of Windows Vista is the Windows NT kernel, and as with Windows 2000 and Windows XP, the default driver model is the Windows Driver Model (WDM). This portion of Vista has remained remarkably unchanged with Windows XP.

WDM Port Class Models

Also, as with Windows 2000 and Windows XP, the foundation of any WDM audio device driver has remained unchanged. All PCI WDM audio drivers are based upon the WDM audio “Port Class” and Windows Vista supports all Windows XP “Mini Port” models, including “Wave Cyclic” and “Wave PCI”. Also, all USB / 1394 WDM audio drivers are based upon “Stream Class” or “A/V Stream”.

WDM Kernel Streaming

As a result of this, any WDM driver that was built under Windows XP should generally work as is under Windows Vista without a recompile. Also, any user mode programs that use “WDM Kernel Streaming” (such as Cakewalk SONAR) in Windows XP would work exactly the same under Windows Vista, when run on top of the driver that was built for Windows XP.

 

 

So what has changed?

New Miniport Type: Wave RT

Microsoft has added a third “Miniport” type for PCI products that is unique to Vista, which is called “Wave RT” (http://www.microsoft.com/whdc/device/audio/wavertport.mspx). The promise of Wave RT is that user mode applications could completely govern streams of audio without any code execution in the kernel during runtime.

1:Wave RT allows the user mode application direct access to the data in the memory that is mapped to the audio hardware DMA engine

2:Wave RT allows the application to poll the current position in the DMA memory window that the hardware is accessing.
3: Wave RT also supports the notion of a hardware generated clock notification event, similar to the ASIO API, so that applications need not poll for current position if they don’t want to.


Wave RT is the new standard, but WavePCI and WaveCyclic are still supported

Microsoft did realize that it would be difficult to get other vendor’s legacy audio drivers moved over to the WaveRT model, because a lot of legacy hardware cannot support this model. So, Microsoft still continues to support the two “Miniport” driver models that were used in Windows XP (“WavePCI” and “WaveCyclic”), which means “WaveRT” drivers are not strictly required under Vista.



 Audio in Windows Vista (2)


If the new Wave RT format is not strictly required, why do I need new drivers for Vista?

The similarities start and end at the kernel miniport level.  After that, everything changes.

What has changed dramatically in Windows Vista is the main OS audio subsystem. This is the part of the OS that handles audio coming from multiple user mode client applications, audio mixing, processing and sample rate conversion. What has also changed radically in Windows Vista is the emulation of the Windows standard audio APIs, Windows Multimedia Extensions (“MME”) and “DirectSound”.

 

The Windows XP audio architecture could be depicted as follows:

 

In this model, both DirectSound and MME may be emulated over the OS audio stack, which was mostly implemented in kernel mode. A low level “Kernel Mixer” (or kMixer) is used to facilitate multiple user mode client applications, audio mixing, processing and sample rate conversion. However, also note that a direct path from DirectSound straight to the audio driver also existed. This was the path that facilitated audio acceleration in DirectSound. Proprietary APIs such as ASIO and OpenAL bypass all of that and go straight to the lowest level of the driver.

 


The Windows Vista audio architecture could be depicted as follows:

 

 

This is derived from a diagram from this website: http://blogs.msdn.com/larryosterman/archive/2006/03/07/545451.aspx, which is an article from the web log of a Microsoft audio developer.

 

Audio Flow through Vista - introducing WASAPI and APOs

The above picture depicts audio flow through Microsoft’s new user mode audio architecture. An application communicates through this path through what is depicted as Sessions, and these Sessions are programmed through what Microsoft calls Windows Audio Session API (or WASAPI).

http://windowssdk.msdn.microsoft.com/en-us/library/ms679162.aspx

The other blocks represent various points where some form of host based audio processing happens (sample rate conversion, mixing, effects). Host based processing modules are also referred to as Audio Processing Objects, or APOs. The above link has more details on the meaning of the other acronyms.

 

More User Mode, Less Kernel Mode
In this model, nearly all blocks in the picture above run in user space. The only portion of this architecture that runs in kernel mode is represented by the single block called “Audio Driver”, and it contains only a minimal amount of Microsoft code. It contains only the Microsoft “Port Class” Driver, the Vendor “Miniport” driver and Vendor Hardware Abstraction Layer portions depicted in the XP driver architecture diagram. Note that the Windows “Kernel Mixer” (or kMixer) is completely gone.


Changes to Direct Sound and MME implementation

Windows “Direct Sound” and “MME” emulation have also radically changed. These emulation layers now sit exclusively on top of the depicted Vista audio architecture, and are basically “Session” instances. “Session 1” could be looked at as an MME application going through a Microsoft emulation layer, and “Session 2” could be looked at as a DirectSound 3D application going through a Microsoft emulation layer.


Reasons for Change

Microsoft had stated reasons for these kinds of radical changes that go beyond “the need to change things”. Reasons include moving as much software out of kernel mode as possible thereby minimizing bug checks (in layman’s terms “BSODs”), developing an architecture to make debugging audio problems in applications easier, and supporting a whole new generation of Digital Rights Management (http://www.microsoft.com/whdc/device/stream/output_protect.mspx) A further description for the rationale of these changes may be seen in this Microsoft developer’s web log entry: (http://blogs.msdn.com/larryosterman/archive/2005/09/19/471346.aspx)



 Audio in Windows Vista (3)



Impacts of Change

These changes had a number of unfortunate side effects.


kMixer dependency issues

First, while all efforts were made to work with all legacy XP audio drivers, the global graph communication to the audio driver does differ from the way kMixer communicated to the audio driver, in terms of timing and processing blocks and demands for more precise reporting of sample position. As a result, any legacy XP audio driver whose behavior depended on kMixer specific behavior could break in Vista, if Vista subjects the driver to an unexpected condition. This was ultimately the root cause of several bugs found in Audigy and X-Fi drivers for Vista, such as audio dropouts, distortions that only happen once a while, constant distortions, or audio/video synchronization drift that only happens after several hours of watching movies. These bugs are being addressed now.

 

Pre-mixed Audio

Second, with the way this new emulation structure, all “MME” and “Direct Sound” applications will ultimately result in pre-mixed PCM audio that is sent to the driver in one and only one format (in terms of sample rate, bit depth and channel count), and that format is governed by a control panel setting that Microsoft would prefer be configured only by the end user. This eliminates any opportunity for hardware to accelerate sample rate conversion or to take full advantage of advanced SRC technologies such as the ones used in the X-Fi product (http://www.soundblaster.com/products/x-fi/technology/lastinfo/ssrc.asp) when using standard operating system audio.

 

Direct Sound 3D HW Acceleration - RIP

In addition, unlike Windows XP, there is no “Direct” path from DirectSound applications to audio drivers or hardware at all. DirectSound is emulated into a Windows audio “Session”, as depicted here:

 

 

The diagram below puts this in perspective in the context of  the entire audio architecture.
Note that DirectSound implementation is circled in red:

 

 

 

Note that the Vista DirectSound emulation sends mixed audio content to the standard OS audio path, and offers no “direct” path to hardware at all. Since the whole point of DirectSound acceleration is to allow hardware to process unmixed audio content, DirectSound cannot be accelerated in this audio model.


Game Audio Issues

This results in bugs such as loss of EAX functionality in games to complete incompatibility, depending on how the game title was authored and how well the Microsoft DirectSound emulation code works. In addition, given this model any and all bugs that are exclusive to DirectSound games could not possibly be due to Creative audio drivers or any other IHV (Independent Hardware Vendors) audio drivers.

 

Custom Audio Effect APOs

Vista does support insertion points for custom audio effects (http://www.microsoft.com/whdc/device/audio/sysfx.mspx, http://www.microsoft.com/whdc/device/audio/vista_sysfx.mspx) depicted above as APO1 and APO3. Forthcoming Creative audio products will use APOs to implement certain features, but these custom effects do not allow acceleration of DirectSound because as mentioned above they receive mixed content, not unmixed content.


Creative supported hardware acceleration for Gaming and Music Creation
The good news here is that, as depicted above, Vista still permits proprietary user mode to kernel mode driver stacks, which means that Creative products may continue to support non Microsoft driver models and technologies such as
OpenAL (http://www.openal.org) for 3D gaming,
SoundFont Management System (http://www.soundfont.com)
ASIO (http://www.steinberg.net) for audio content creation.
As was the case in Windows XP, these audio interfaces will continue to be thin pedal-to-the-metal APIs that allow user mode applications to access hardware features directly.


OpenAL - the key to optimum audio for gaming in Windows Vista
OpenAL continues to be the most widely used API for optimum  3D sound in PC gaming and the direct to hardware path offered by this API is the only way to access the hardware accelerated audio processing offered by cards in the Sound Blaster range.
Combined with Creative’s high precision SRC technology, patented 3D audio spatialization and EAX technology, multi-channel / multi-speaker rendering, EAX 5.0 DSP effects, Crystalizer and CMSS technology, Creative’s Sound Blaster X-Fi continues to be THE ultimate audio solution for Windows gaming.
While the Microsoft architecture works very well for simple multimedia applications such as music listening and moving watching, these technologies will continue to offer optimal performance with minimal CPU impact in gaming and music creation applications for years to come.

你可能感兴趣的:(Audio in Windows Vista)