windows98 的midi 音量用程序如何控制?(200分)

R

rayman1

Unregistered / Unconfirmed
GUEST, unregistred user!
打开windows98 的 volume control 可以控制midi 的音量,
但是在程序(delphi 4) 中如何直接控制midi's volume?
请别见笑 ~o~
 
可以的, 用
midiOutSetVolume
当中第一个参数是应该就是MediaPlayer.DeviceID。
不过我不敢肯定,第二个是音量。

这是原文:

hmo

Handle of an open MIDI output device. This parameter can also contain the handle of a MIDI stream, as long as it is cast to
HMIDIOUT.

dwVolume

New volume setting. The low-order word contains the left-channel volume setting, and the high-order word contains the right-channel setting. A value of 0xFFFF represents full volume, and a value of 0x0000 is silence.
If a devicedo
es not support both left and right volume control, the low-order word of dwVolume specifies the mono volume level, and the high-order word is ignored.
 
我有一个控制 Midi音量的源码,你需要可以mail
 
用waveOutSetVolume应该可以吧,左右声道单独控制。播放用MCI指令或控件。
 
使用auxsetvolume();
 
用midioutsetvolume() 在USE MMSYSTEM 中
第一个参数随便取一下,第二个参数设置它的音量.
但我用了一下发现,对有的声卡,该函数有用;有的声卡不接受.
我曾下载了一些控件(你如果要的话,我可以寄给你),也有这个问题.那位大虾能解释这
个原因,请告诉我!
 
呵呵, 这么久的信息也翻出来了:)
 
其实这个问题早就有的。请你关注以前cj的几个问题和回答,就可以知道了。
利用waveoutsetvolume就可以实现了。它的第一个参数是deviceID。第二个是一组
数字,表示声道
hmo

Handle of an open MIDI output device. This parameter can also contain the handle of a MIDI stream, as long as it is cast to HMIDIOUT. This parameter can also be a device identifier.

dwVolume

New volume setting. The low-order word contains the left-channel volume setting, and the high-order word contains the right-channel setting. A value of 0xFFFF represents full volume, and a value of 0x0000 is silence.
If a devicedo
es not support both left and right volume control, the low-order word of dwVolume specifies the mono volume level, and the high-order word is ignored.

 
调整midi音量用
midiOutSetVolume,midiOutGetVolume
调整wave音量用
waveOutSetVolume,waveOutGetVolume
我用时好像第一个参数取0都可以实现。
 
找到了:) 这里是主要代码:)
type Tvolume=record
left,right:word;
end;

procedure fillstruct(control:pMixerControl;var Cdetails:tMIXERCONTROLDETAILS);
function getpeak(control:pMixerControl;var peak:integer):boolean;
function setvolume(control:pmixercontrol;
volume:Tvolume):boolean;
function getvolume(control:pmixercontrol;
volume:Tvolume):boolean;

var
Form1: TForm1;
mcontrols:array of array of array of PMixerControl;
//mixer的数组
fmixerhandle:HMIXER;
//mixer的句柄

implementation

{$R *.DFM}

procedure fillstruct(control:pMixerControl;var Cdetails:tMIXERCONTROLDETAILS);
begin

Cdetails.cbStruct:=sizeof(cdetails);
cdetails.dwControlID:=Control.dwControlID;
cdetails.cbDetails:=sizeof(integer);
cdetails.hwndOwner:=0;
end;

function getpeak(control:pMixerControl;var peak:integer):boolean;
var
details:TMixerControlDetailsSigned;
cdetails:tMIXERCONTROLDETAILS;
begin

Result:=false;
if control.dwControlType<> mixercontrol_controltype_peakmeter then
exit;
cdetails.cChannels:=1;
cdetails.paDetails:=@details;
fillstruct(control,cdetails);
result:=mixerGetControlDetails(fmixerhandle,@cdetails,MIXER_GETCONTROLDETAILSF_VALUE)=0;
end;

function setvolume(control:pmixercontrol;
volume:Tvolume):boolean;
var
details:array[0..30] of integer;
cdetails:tMIXERCONTROLDETAILS;
begin

fillstruct(control,cdetails);
cdetails.cChannels:=2;
cdetails.paDetails:=@details;
details[0]:=volume.left;
details[1]:=volume.right;
result:=mixerSetControlDetails(fmixerhandle,@cdetails,MIXER_GETCONTROLDETAILSF_VALUE)=0;
volume.left:=details[0];
volume.right:=details[1];
end;

function getvolume(control:pmixercontrol;
volume:Tvolume):boolean;
var
details:array[0..30] of integer;
cdetails:tMIXERCONTROLDETAILS;
begin

fillstruct(control,cdetails);
cdetails.cChannels:=2;
cdetails.paDetails:=@details;
result:=mixerGetControlDetails(fmixerhandle,@cdetails,MIXER_GETCONTROLDETAILSF_VALUE)=0;
volume.left:=details[0];
volume.right:=details[1];
end;


 
midiOutSetVolume
midiOutGetVolume
 
分分大富翁的命根。问题泰老了
 
呵呵, 我已经不需要分了:) 只是顺便贴在这里:)
 
补充一下 midioutsetvolume() 的二个参数最大为 $ffff,第一十设置 左右声
道的
 
黑斑竹咱把分分了吧
 
use mmsystem
用waveOutSetVolume
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
934
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
750
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
顶部