Directsound Study Notes (4): Device Performance

Source: Internet
Author: User

Device Performance

Directsound enables your applicationProgramYou can check the hardware performance of the sound device. Many applications do not need to do this because directsound automatically uses any available hardware acceleration. However, applications with good performance can use this information to scale their voice requirements based on available hardware. For example, if the hardware mixing is available, an application may choose to play multiple audio streams.

After calling the directsoundcreate8 function to create a device object, your application can call the idirectsound8: getcaps method to obtain the performance of the sound device.
The following example shows the performance of the device identified by the idirectsound8 interface pointer lpdirectsound.

Dscaps;
 
Dscaps. dwsize = Sizeof (Dscaps );
Hresult HR = Lpdirectsound -> Getcaps ( & Dscaps );
If (Failed (HR ))
{
Errorhandler (HR );//Add error-handling here.
}

The dscaps structure obtains the performance and resource information of sound devices, including the largest number of resources and the number of currently available resources. Note that the dwsize member of this structure must be initialized before the method call.

If your application depends on hardware performance, you must call the idirectsound8: getcaps method during each buffer location to determine whether you have sufficient resources to create the next buffer.

Speaker Configuration

directsound uses the speaker configuration-that is, the location of the speaker relative to the audience-to optimize the 3D effect of the user's sound system.
in Windows 98, Windows 2000, and later operating systems, you can set the speaker configuration in the control panel. An application can obtain this value by using idirectsound8: getspeakerconfig. The application should not overwrite the setting by calling idirectsound8: setspeakerconfig, because it is a global setting that will mirror other users and applications.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.