在网上找到了一个 Windows传统声音API接口waveOut的使用demo,先保存下来以后用到的时候再拿来看。
原文:https://blog.csdn.net/gb1230/article/details/41350189
值得注意的是waveOutSetVolume(...)这个设置音量的函数,它可以设置程序音量和系统音量(网上有讨论说有些情况设置系统音量无效)关于这个函数的详细解释在 https://docs.microsoft.com/en-us/previous-versions//dd743874(v=vs.85)
#include <windows.h>
#include <mmsystem.h>
#include <stdio.h>
#include <queue>
using std::queue;
#pragma comment(lib,"winmm.lib")
/*
* some good values for block size and count
*/
#define BLOCK_SIZE 4096
#define BLOCK_COUNT 3
/*
*waveoutprocdecodethread share vars
*/
static CRITICAL_SECTION waveCriticalSection;
static HANDLE freeBufferSema;
static queue<WAVEHDR*> qWHDR;
typedef struct decodeThreadParam
{