Core Audio is implemented on vista/win7

Source: Internet
Author: User
Tags new set stream api

Application Range: vista/win7, XP not supported 1. About Windows Core Auido APIs

Under Windowss Vista and the Windows 7 operating system, Microsoft provides a new set of audio components for applications to improve audio quality. Core Audio APIs provide a way to use these components and are the basis for the implementation of more advanced APIs. For example: APIs such as DirectSound, Directmuisc, wavexxx, and mixerxxx are built on top of them. The relationship between them is as shown.


Core Audio APIs consist of three main parts: Mmdevice API, WASAPI, Devicetoplogyapi. The three focus on different aspects respectively.
Mmdevice API: An audio-side node device used to enumerate systems.
WASAPI (Windows Audio stream API): Used to create and manage audio streams to and from audio-side node devices.
DEVICETOPLOGYAPI: Get the topology and function of the hardware device directly.
This paper mainly introduces the function of audio stream management using WASAPI to realize the system recording function.

2. Management of audio streams

After enumerating the system's audio devices and making playback and recording devices, the next step is to turn on the device connection and manage the traffic on that connection. WASAPI allows applications to create and manage audio streams. The application can use WASAPI to implement rendering a stream, capturing a stream, and loopback recording. We can use loopback recording to achieve the system recording function, to achieve the "record what you hear" purpose.
In loopback mode, the WASAPI application can capture the audio stream that the playback device is currently playing. The operation steps are:

    • Get the Immdevice interface for the playback device port
    • Gets the audio playback format on the specified device
    • Initializing the loopback mode audio capture stream on the playback device port
    • Call the Iaudioclient::getservice method to get the Iaudiocaptureclient interface
    • The capture thread is turned on, and the capture thread loops alternately calls the Iaudiocaptureclient::getbuffer and Iaudiocaptureclient::releasebuufer methods to obtain the audio data after writing the specified file

3. Programme deficiencies

According to MSDN, the loopback mode can only be used for shared-mode audio streams, and there is no way to exclusive-mode audio streams, which means that the scheme will fail if it encounters a exclusive-mode audio stream. However, Exclusive-mode is rarely seen in the case of the demo test in each of the use cases. In addition, because the WASAPI is only provided by Windows Vista and above, it is not possible to use this scheme under XP, which is highly dependent on the system and is less portable.

Reference:
MSDN Related sections:
msdn.microsoft.com/en-us/library/dd370802 (vs.85). aspx

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.