Ways to play PCM audio using WINDOWSAPI

Source: Internet
Author: User

This article mainly introduces the use of WINDOWSAPI implementation of the PCM audio method, very practical a function, the need for friends can refer to the next

This paper introduces the method of using WINDOWSAPI to realize the playback of PCM audio, which is similar to the principle of using WINDOWSAPI to get audio recording, so it is no longer detailed to describe the parameters of the specific function and structure, the same part is omitted, and the main functional part of the code is introduced. As shown below:

1. Waveoutgetnumdevs

2. Waveoutgetdevcaps

3. Waveoutopen

callback function:

?
1 voidCALLBACK PlayCallback(HWAVEOUT hwaveout, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORDdwParam2);

4. Waveoutprepareheader

5. Waveoutwrite: Start playing immediately after execution, the current buffer playback completion will call the callback function

Here's what to note:

In order to be able to achieve a continuous playback effect, in the 4th need to prepare two or two more playback data.
Interested friends can compare the previous article manually debug the example described in this article.

Ways to play PCM audio using WINDOWSAPI

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.