Windows 音频API函数(I)
来源:互联网 发布:淘宝上门取件 哪个快递 编辑:程序博客网 时间:2024/05/24 05:59
最近项目需要音频,研究一下了Waveform函数组
分音频播放和录音
音频播放使用过程如下:
1.waveOutOpen 打开音频设备 This function opens a specified waveform output device for playback.
MMRESULT waveOutOpen(
LPHWAVEOUT phwo,
UINT uDeviceID,
LPWAVEFORMATEX pwfx,
DWORD dwCallback,
DWORD dwInstance,
DWORD fdwOpen
);
一般过程调用两次,第一次把fdwOpen设置为WAVE_FORMAT_QUERY,MSDN上的解释:
If this flag is specified, waveOutOpen queries the device to determine if it supports the specified format, but the device is not actually opened.
根据pwfx提供的格式判断设备是否支持,但不打开指定设备
第二次调用则打开设备,dwCallback指定返回消息指定的线程
2.然后直接把解码后的音频数据放到缓冲区进行播放即可,可以采用双缓冲区的方式改善播放效果,解码可以使用开源的ffmpeg,效果不错,使用起来也不是很麻烦,有时间把ffmpeg使用过程总结一下
1)waveOutPrepareHeader准备数据进行播放MMRESULT waveOutPrepareHeader(
HWAVEOUT hwo,
LPWAVEHDR pwh, UINT cbwh
);
初始化pwh数据项进行播放
2)waveOutWrite播放waveOutPrepareHeader准备的数据
3.waveOutClose,关闭设备
OK,现在就可以播放
- Windows 音频API函数(I)
- Windows 音频API函数(II)
- webrtc windows api音频采集总结
- Windows下wave API 音频采集
- 用Mixer API函数实现音频设置
- windows API函数简介
- Windows API函数大全
- Windows API函数大全
- Windows API函数大全
- WINDOWS API 函数
- Windows API 函数大全
- Windows API函数大全
- Windows API函数大全
- Windows API函数大全
- Windows API函数大全
- Windows API函数大全
- Windows API函数大全
- Windows API函数大全
- 集群和分布式
- 这些年做项目带新人的经验总结(转帖)
- 初探Ogre 引擎!---- (2)OGRE初级教程
- Android SDK 1.5中文版 (Application基础—2)
- oracle函数大全-字符处理函数
- Windows 音频API函数(I)
- 需求调研在企业软件项目管理中的应用
- boost::shar_ptr使用
- 端口占用问题
- 自我介绍
- PHP:短信监控网站运行状态
- POJ 2247
- ipp2p中使用tc+iptables限速(脚本)
- error C2220: 警告被视为错误 - 没有生成“object”文件