Warning: file_get_contents(https://whois.pconline.com.cn/jsLabel.jsp?ip=127.0.0.1) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 503 Service Temporarily Unavailable in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884
BASS库,用于播放音频 - huidong

huidong

首页 | 会员登录 | 关于争取 2022 寒假做出汇东网 Ver3.0.0 !
搜索文章


下载:

BASS播放器.zip


里面有三个文件,lib ; h ; dll

将lib和h放到工程目录,dll放到程序目录下

然后在代码中:

//音频库
#include "bass.h"
#pragma comment(lib,"bass.lib")


播放音乐:

HSTREAM Sound[4]={0};

//初始化
//BASS_Init(启用设备-1表示默认,采样率,效果参数,窗口句柄,0表示使用默认数据初始化DirectSound)
BASS_Init(-1, 44100, 0, 0, NULL);

//打开文件
//BASS_StreamCreateFile(是否从内存中加载,文件路径,播放起始位置,播放终止位置,播放效果标志位)
Sound[0] = BASS_StreamCreateFile(FALSE, "x.mp3", 0, 0, BASS_SAMPLE_LOOP);
BASS_SetVolume(0.1f);

//播放
BASS_ChannelPlay(Sound[0],FALSE);

//暂停
BASS_ChannelStop(Sound[0]);

//关闭
BASS_Free();






返回首页


Copyright (C) 2018-2024 huidong