DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: power71483
今日帖子: 14
在线用户: 9
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 zhouying (zy) ★☆☆☆☆ -
盒子活跃会员
2019/12/24 22:27:54
标题:
那个兄弟熟悉bass的开发啊?急 浏览:1496
加入我的收藏
楼主: procedure TForm1.Button1Click(Sender: TObject);
var
  info: BASS_DEVICEINFO;
  i: Integer;
begin
  i := 1;
  while BASS_GetDeviceInfo(i, info) do
  begin
    ListBox1.Items.Add(string(info.name));
    Inc(i);
  end;
end;

//上面的代码用于显示音频输出框。那怎么样才可以选择bass的输出啊?
比如要音响,耳机等
难不成每次运行前先判断?
BASS_Init(-1, 44100, 0, 0, nil) //-1为当前设备?
----------------------------------------------
-
作者:
男 zhouying (zy) ★☆☆☆☆ -
盒子活跃会员
2019/12/24 23:09:12
1楼: 有兄弟知道不?
----------------------------------------------
-
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2019/12/24 23:40:33
2楼: I dont know about this library but you can read tge help here

http://www.un4seen.com/   (forum )

http://www.un4seen.com/doc/#bass

http://www.un4seen.com/doc/#bass/BASS_GetDeviceInfo.html
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2019/12/24 23:46:17
3楼:
search for "BASS_GetDeviceInfo"

http://www.un4seen.com/forum/?topic=18720.msg131159;topicseen#msg131159
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 zhouying (zy) ★☆☆☆☆ -
盒子活跃会员
2019/12/25 20:07:14
4楼: I dont understand...
----------------------------------------------
-
作者:
男 zhouying (zy) ★☆☆☆☆ -
盒子活跃会员
2019/12/25 21:38:53
5楼: I use BASS_ChannelSetDevice(chan,combobox2.itemindex)
doesn't work too
----------------------------------------------
-
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2019/12/26 5:09:04
6楼: Sorry! I dont have this component suite or your environment to test!

if possible try upload your project (if possible complete) to analyse
if possible, say more details how you to do ok?

and how I can download the component to test (same TRIAL)

hug
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 nickemma (N.E Zhou) ★☆☆☆☆ -
普通会员
2019/12/26 11:32:52
7楼: @zhouying (zy)

BASS_Init(-1, 44100, 0, 0, nil)
-1为系统当前默认输出设备

每次程序启动先BASS_GetDeviceInfo获取系统可以输出的设备。
请注意,虽然系统声卡支持主输出(常见声卡绿色输出孔)、LineOut(常见声卡蓝色输出孔)等,但Windows 7/8/10都会有设备插入后,才启用。
意思说:虽然你声卡支持多路输出,但是你只有主输出接入设备的话,BASS_GetDeviceInfo只会获得1个输出设备。你想获得多个输出,必须都需要接入设备,这个并不是程序可以控制,是Windows系统底层设计。
最后在保证系统可以有多个输出设备后,使用BASS_SetDevice设定输出设备。

总结:
1、保证系统声卡输出设备已经接入
2、在FormCreate的时候:
   BASS_GetDeviceInfo 获取设备(可选,可以在Debug时候查看)
   BASS_SetDevice 设定输出设备
   BASS_Init(x, 44100, 0, 0, nil) 初始化BASS库,x为输出设备序号
----------------------------------------------
-
作者:
男 zhouying (zy) ★☆☆☆☆ -
盒子活跃会员
2019/12/26 16:14:48
8楼: @nickmma
多谢,但是我用
procedure TForm1.Button1Click(Sender: TObject);
var
  info: BASS_DEVICEINFO;
  i: Integer;
begin
  i := 1;
  while BASS_GetDeviceInfo(i, info) do
  begin
    ListBox1.Items.Add(string(info.name));
    Inc(i);
  end;
end;

可以在listbox里面显示输出设备
只有我用了bass_setdevice(listbox.itemindex)
没有反应?还是说除了上面这句之后,还要在添加下面这条?
BASS_Init(listbox.itemindex, 44100, 0, 0, nil)
----------------------------------------------
-
作者:
男 nickemma (N.E Zhou) ★☆☆☆☆ -
普通会员
2019/12/26 17:08:42
9楼: @zhouying (zy)
procedure TForm1.Button1Click(Sender: TObject);
var
  info: BASS_DEVICEINFO;
  i: Integer;
begin
  i := 1;
  while BASS_GetDeviceInfo(i, info) do
  begin
    ListBox1.Items.Add(inttostr(i) + '  ' + string(info.name));
    Inc(i);
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 //X为你想要输出的设备
 if not BASS_Init(x, 44100, 0, 0, nil) then ShowMessage('初始化错误');
end;

你把这两个按钮的反应好歹都截个图啊。

BASS_SetDevice 多数应用于多线程的选择不同的输出播放
----------------------------------------------
-
作者:
男 zhouying (zy) ★☆☆☆☆ -
盒子活跃会员
2019/12/26 17:27:19
10楼: 不会出现错误啊,就是直接会在listbox里面显示多个输出设备,比如会有,蓝牙音响,耳机等,我想要的功能是,点击某个设备,之后重启软件后,会从相应的设备中发声,现在的问题是,重启之后,如果蓝牙音响和耳机都开着,他首选会从蓝颜音响里面出生。不管之前我选什么
----------------------------------------------
-
作者:
男 nickemma (N.E Zhou) ★☆☆☆☆ -
普通会员
2019/12/26 20:27:50
11楼: @zhouying
ini文件形式记录好要输出设备的“设备名”
    
程序启动时,ini文件读入设备名,并在获得所有输出设备后: 
i:=ListBox1.Items.Indexof('设备名');
 if not BASS_Init(i, 44100, 0, 0, nil) then ShowMessage('初始化错误');

另外你开贴时的问题跟现在的问题是两码事。
----------------------------------------------
-
作者:
男 zhouying (zy) ★☆☆☆☆ -
盒子活跃会员
2019/12/26 20:31:59
12楼: @nickemma
没有啊,是同一个问题啊,我是用ini进行保存。另外你所说的设备名,我怎么知道客户电脑里面的设备名称呢?
----------------------------------------------
-
作者:
男 nickemma (N.E Zhou) ★☆☆☆☆ -
普通会员
2019/12/27 11:05:23
13楼: @zhouying (zy)
最后一次回答你,要不然剩下就是帮你写程序了。

procedure TForm1.Button1Click(Sender: TObject);
var
  info: BASS_DEVICEINFO;
  i: Integer;
begin
  i := 1;
  while BASS_GetDeviceInfo(i, info) do
  begin
    ListBox1.Items.Add(string(info.name));
    Inc(i);
  end;
end;

info.name 是干嘛的?

另外 "我怎么知道客户电脑里面的设备名称呢?"  死脑筋的程序员,你就不会在客户的电脑上面做个保存的Button?让客户选择一下输出的设备,保存到INI文件吗?
----------------------------------------------
-
作者:
男 zhouying (zy) ★☆☆☆☆ -
盒子活跃会员
2019/12/28 15:40:04
14楼: 已经搞定了。呵呵,谢谢
----------------------------------------------
-
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行70.3125毫秒 RSS