谁能说说怎样调节音量??

boatzm 2003-10-18 02:54:03
我这儿有个函数但不清楚 各参数的意义,那个大哥解释下哈?

//音量控制
procedure TForm1.TrackBar1Change(Sender: TObject);
var
t,v:Longint;
begin
t:=TrackBar1.Position;
v:=(t shl 8)or(t shl 24);
waveOutSetVolume(0,v);
end;

就是 waveOutSetVolume(0,v); 0 和v 是代表什么??
v:=(t shl 8)or(t shl 24); shl 是???
...全文
120 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
syda1 2003-10-26
  • 打赏
  • 举报
回复
不用第三方控件该怎么写,不要去控制wave音量,而要控制volume。
困扰了我许久。
CDSoftwareWj 2003-10-21
  • 打赏
  • 举报
回复

function TAudioMixer.SetVolume (ADestination,AConnection:Integer;LeftVol,RightVol,Mute:Integer):Boolean;
var MD:TMixerDestination;
MC:TMixerConnection;
Cntrls:TMixerControls;
MCD:TMixerControlDetails;
Cntrl:PMixerControl;
A,B:Integer;
ML:TMixerLine;
details:array [0..30] of Integer;
VolSet,MuteSet:Boolean;
begin
Result:=False;
MD:=Destinations[ADestination];
If MD<>nil then
begin
If AConnection=-1 then
begin
Cntrls:=MD.Controls;
ML:=MD.Data;
end
else
begin
MC:=MD.Connections[AConnection];
If MC<>nil then
begin
Cntrls:=MC.Controls;
ML:=MC.Data;
end
else
Cntrls:=nil;
end;
If Cntrls<>nil then
begin
A:=0;
VolSet:=LeftVol=-1;
MuteSet:=Mute=-1;
Result:=True;
while (not VolSet OR not MuteSet) AND (A<Cntrls.Count) do
begin
Cntrl:=Cntrls[A];
If Cntrl<>nil then
begin
If ((Cntrl.dwControlType=MIXERCONTROL_CONTROLTYPE_VOLUME) OR
(Cntrl.dwControlType=MIXERCONTROL_CONTROLTYPE_MUTE)) AND
(Cntrl.fdwControl AND MIXERCONTROL_CONTROLF_MULTIPLE<>MIXERCONTROL_CONTROLF_MULTIPLE)
then
begin
MCD.cbStruct:=SizeOf(TMixerControlDetails);
MCD.dwControlID:=Cntrl.dwControlID;
If Cntrl.fdwControl AND MIXERCONTROL_CONTROLF_UNIFORM>0 then
MCD.cChannels:=1
else
MCD.cChannels:=ML.cChannels;
MCD.cMultipleItems:=0;
MCD.cbDetails:=SizeOf(Integer);
MCD.paDetails:=@Details;
If (Cntrl.dwControlType=MIXERCONTROL_CONTROLTYPE_VOLUME) AND not VolSet then
begin
Details[0]:=LeftVol;
If RightVol=-1 then
Details[1]:=LeftVol
else
Details[1]:=RightVol;
VolSet:=True;
end
else
If (Cntrl.dwControlType=MIXERCONTROL_CONTROLTYPE_MUTE) AND not MuteSet then
begin
Details[0]:=Mute;
MuteSet:=True;
end;
mixerSetControlDetails (FMixerHandle,@MCD,MIXER_GETCONTROLDETAILSF_VALUE);
end;
end;
Inc (A);
end;
If not MuteSet then
begin
If AConnection<>-1 then
begin
Cntrls:=MD.Controls;
ML:=MD.Data;
If Cntrls<>nil then
begin
A:=0;
while not MuteSet AND (A<Cntrls.Count) do
begin
Cntrl:=Cntrls[A];
If (Cntrl.dwControlType AND MIXERCONTROL_CONTROLTYPE_MIXER=MIXERCONTROL_CONTROLTYPE_MIXER) OR
(Cntrl.dwControlType AND MIXERCONTROL_CONTROLTYPE_MUX=MIXERCONTROL_CONTROLTYPE_MUX) then
begin
MCD.cbStruct:=SizeOf(TMixerControlDetails);
MCD.dwControlID:=Cntrl.dwControlID;
If Cntrl.fdwControl AND MIXERCONTROL_CONTROLF_UNIFORM>0 then
MCD.cChannels:=1
else
MCD.cChannels:=ML.cChannels;
If Cntrl.fdwControl AND MIXERCONTROL_CONTROLF_MULTIPLE=MIXERCONTROL_CONTROLF_MULTIPLE then
MCD.cMultipleItems:=Cntrl.cMultipleItems
else
MCD.cMultipleItems:=0;
MCD.cbDetails:=4;
MCD.paDetails:=@Details;
MuteSet:=True;
mixerGetControlDetails (FMixerHandle,@MCD,MIXER_GETCONTROLDETAILSF_VALUE);
For B:=0 to Cntrl.cMultipleItems-1 do
Details[B]:=0;
Details[AConnection]:=Mute;
mixerSetControlDetails (FMixerHandle,@MCD,MIXER_GETCONTROLDETAILSF_VALUE);
end;
Inc (A);
end;
end;
end;
end;
end;
end;
end;

procedure Register;
begin
RegisterComponents('Samples', [TAudioMixer]);
end;

end.


把上面的保存为 AMixer.pas

然后你就用吧 hehe^^ 这可是控制 Windows 系统级音量哦

---------
春困秋乏夏打盹,睡不醒的冬三月 ^^!
CDSoftwareWj 2003-10-21
  • 打赏
  • 举报
回复
function TAudioMixer.GetVolume (ADestination,AConnection:Integer;var LeftVol,RightVol,Mute:Integer;var VolDisabled,MuteDisabled:Boolean):Boolean;
var MD:TMixerDestination;
MC:TMixerConnection;
Cntrls:TMixerControls;
MCD:TMixerControlDetails;
Cntrl:PMixerControl;
A,B:Integer;
ML:TMixerLine;
details:array [0..30] of Integer;
begin
Result:=False;
MD:=Destinations[ADestination];
If MD<>nil then
begin
If AConnection=-1 then
begin
Cntrls:=MD.Controls;
ML:=MD.Data;
end
else
begin
MC:=MD.Connections[AConnection];
If MC<>nil then
begin
Cntrls:=MC.Controls;
ML:=MC.Data;
end
else
Cntrls:=nil;
end;
If Cntrls<>nil then
begin
A:=0;
Result:=True;
LeftVol:=-1;
RightVol:=-1;
Mute:=-1;
while ((LeftVol=-1) OR (Mute=-1)) AND (A<Cntrls.Count) do
begin
Cntrl:=Cntrls[A];
If Cntrl<>nil then
begin
If ((Cntrl.dwControlType=MIXERCONTROL_CONTROLTYPE_VOLUME) OR
(Cntrl.dwControlType=MIXERCONTROL_CONTROLTYPE_MUTE)) AND
(Cntrl.fdwControl AND MIXERCONTROL_CONTROLF_MULTIPLE<>MIXERCONTROL_CONTROLF_MULTIPLE)
then
begin
MCD.cbStruct:=SizeOf(TMixerControlDetails);
MCD.dwControlID:=Cntrl.dwControlID;
If Cntrl.fdwControl AND MIXERCONTROL_CONTROLF_UNIFORM>0 then
MCD.cChannels:=1
else
MCD.cChannels:=ML.cChannels;
MCD.cMultipleItems:=0;
MCD.cbDetails:=SizeOf(Integer);
MCD.paDetails:=@details;
B:=mixerGetControlDetails (FMixerHandle,@MCD,MIXER_GETCONTROLDETAILSF_VALUE);
If B=MMSYSERR_NOERROR then
begin
If (Cntrl.dwControlType=MIXERCONTROL_CONTROLTYPE_VOLUME) AND (LeftVol=-1) then
begin
VolDisabled:=Cntrl.fdwControl AND MIXERCONTROL_CONTROLF_DISABLED>0;
If not VolDisabled then
begin
LeftVol:=details[0];
If MCD.cChannels>1 then
RightVol:=Details[1];
end;
end
else
If (Cntrl.dwControlType=MIXERCONTROL_CONTROLTYPE_MUTE) AND (Mute=-1) then
begin
MuteDisabled:=Cntrl.fdwControl AND MIXERCONTROL_CONTROLF_DISABLED>0;
If not MuteDisabled then
begin
If Details[0]<>0 then
Mute:=1
else
Mute:=0;
end;
end;
end;
end;
end;
Inc (A);
end;
If Mute=-1 then
begin
If AConnection<>-1 then
begin
Cntrls:=MD.Controls;
ML:=MD.Data;
If Cntrls<>nil then
begin
A:=0;
while (Mute=-1) AND (A<Cntrls.Count) do
begin
Cntrl:=Cntrls[A];
If (Cntrl.dwControlType AND MIXERCONTROL_CONTROLTYPE_MIXER=MIXERCONTROL_CONTROLTYPE_MIXER) OR
(Cntrl.dwControlType AND MIXERCONTROL_CONTROLTYPE_MUX=MIXERCONTROL_CONTROLTYPE_MUX) then
// Mux is similar to mixer, but only one line can be selected at a time
begin
MCD.cbStruct:=SizeOf(TMixerControlDetails);
MCD.dwControlID:=Cntrl.dwControlID;
If Cntrl.fdwControl AND MIXERCONTROL_CONTROLF_UNIFORM>0 then
MCD.cChannels:=1
else
MCD.cChannels:=ML.cChannels;
If Cntrl.fdwControl AND MIXERCONTROL_CONTROLF_MULTIPLE=MIXERCONTROL_CONTROLF_MULTIPLE then
MCD.cMultipleItems:=Cntrl.cMultipleItems
else
MCD.cMultipleItems:=0;
MCD.cbDetails:=4;
MCD.paDetails:=@Details;
B:=mixerGetControlDetails (FMixerHandle,@MCD,MIXER_GETCONTROLDETAILSF_VALUE);
If B=MMSYSERR_NOERROR then
Mute:=Details[AConnection];
end;
Inc (A);
end;
end;
end;
end;
If LeftVol=-1 then
VoldIsabled:=True;
If Mute=-1 then
MuteDisabled:=True;
end;
end;
end;


---------
春困秋乏夏打盹,睡不醒的冬三月 ^^!
CDSoftwareWj 2003-10-21
  • 打赏
  • 举报
回复
{----------------}
{TMixerConnection}
{----------------}

constructor TMixerConnection.Create (AMixer:TAudioMixer;AData:TMixerLine);
begin
FData:=AData;
XMixer:=AMixer;
FControls:=TMixerControls.Create (AMixer,AData);
end;

destructor TMixerConnection.Destroy;
begin
FControls.Free;
inherited;
end;

{-----------------}
{TMixerConnections}
{-----------------}

constructor TMixerConnections.Create (AMixer:TAudioMixer;AData:TMixerLine);
var A,B:Integer;
ML:TMixerLine;
begin
XMixer:=AMixer;
FConnections:=TPointerList.Create;
FConnections.OnFreeItem:=Dofreeitem;
ML.cbStruct:=SizeOf(TMixerLine);
ML.dwDestination:=AData.dwDestination;
For A:=0 to AData.cConnections-1 do
begin
ML.dwSource:=A;
B:=MixerGetLineInfo (AMixer.MixerHandle,@ML,MIXER_GETLINEINFOF_SOURCE);
If B=MMSYSERR_NOERROR then
FConnections.Add(Pointer(TMixerConnection.Create (XMixer,ML)));
end;
end;

destructor TMixerConnections.Destroy;
begin
FConnections.Free;
inherited;
end;

procedure TMixerConnections.DoFreeItem (Pntr:Pointer);
begin
TMixerConnection(Pntr).Free;
end;

function TMixerConnections.GetConnection (Ind:Integer):TMixerConnection;
begin
Result:=FConnections.Pointer[Ind];
end;

function TMixerConnections.GetCount:Integer;
begin
Result:=FConnections.Count;
end;

{-----------------}
{TMixerDestination}
{-----------------}

constructor TMixerDestination.Create (AMixer:TAudioMixer;AData:TMixerLine);
begin
FData:=AData;
XMixer:=AMixer;
FConnections:=TMixerConnections.Create (XMixer,FData);
FControls:=TMixerControls.Create (XMixer,AData);
end;

destructor TMixerDestination.Destroy;
begin
Fcontrols.free;
FConnections.Free;
inherited;
end;

{------------------}
{TMixerDestinations}
{------------------}

constructor TMixerDestinations.Create (AMixer:TAudioMixer);
var A,B:Integer;
ML:TMixerLine;
begin
FDestinations:=TPointerList.Create;
FDestinations.OnFreeItem:=DoFreeItem;
For A:=0 to AMixer.MixerCaps.cDestinations-1 do
begin
ML.cbStruct:=SizeOf(TMixerLine);
ML.dwDestination:=A;
B:=MixerGetLineInfo (AMixer.MixerHandle,@ML,MIXER_GETLINEINFOF_DESTINATION);
If B=MMSYSERR_NOERROR then
FDestinations.Add(Pointer(TMixerDestination.Create (AMixer,ML)));
end;
end;

procedure TMixerDestinations.DoFreeItem (Pntr:Pointer);
begin
TMixerDestination(Pntr).Free;
end;

destructor TMixerDestinations.Destroy;
begin
FDestinations.Free;
inherited;
end;

function TMixerDestinations.GetDestination (Ind:Integer):TMixerDestination;
begin
Result:=FDestinations.Pointer[Ind];
end;

function TMixerDestinations.GetCount:Integer;
begin
Result:=FDestinations.Count;
end;

{-----------}
{TAudioMixer}
{-----------}

constructor TAudioMixer.Create (AOwner:TComponent);
begin
inherited Create (AOwner);
FDestinations:=nil;
XWndHandle:=AllocateHWnd (MixerCallBack);
FMixersCount:=mixerGetNumDevs;
FMixerID:=-1;
If FMixersCount>0 then
SetMixerID (0);
end;

destructor TAudioMixer.Destroy;
begin
closemixer;
if XWndHandle<>0 then
DeAllocateHwnd(XWndHandle);
inherited;
end;

procedure TAudioMixer.CloseMixer;
begin
If FMixerID>=0 then
begin
mixerClose (FMixerHandle);
FMixerID:=-1;
end;
FDestinations.Free;
FDestinations:=nil;
end;

procedure TAudioMixer.SetMixerID (Value:Integer);
begin
If Value>=FMixersCount then
Exit;
CloseMixer;
If Value>=0 then
If mixerOpen (@FMixerHandle,Value,XWndHandle,0,CALLBACK_WINDOW OR MIXER_OBJECTF_MIXER)=MMSYSERR_NOERROR then
begin
FMixerID:=Value;
mixerGetDevCaps (MixerID,@FMixerCaps,SizeOf (TMixerCaps));
FDestinations:=TMixerDestinations.Create (Self);
end;
end;

procedure TAudioMixer.MixerCallBack (var Msg:TMessage);
begin
case Msg.Msg of
MM_MIXM_LINE_CHANGE:
If Assigned (OnLineChange) then
OnLineChange (Self,Msg.wParam,Msg.lParam);
MM_MIXM_CONTROL_CHANGE:
If Assigned (OnControlChange) then
OnControlChange (Self,Msg.wParam,Msg.lParam);
end;
end;

谁在顶一下 还没有完呢

---------
春困秋乏夏打盹,睡不醒的冬三月 ^^!
CDSoftwareWj 2003-10-21
  • 打赏
  • 举报
回复
TMixerConnections=class(TObject)
private
XMixer:TAudioMixer;
FConnections:TPointerList;
protected
procedure DoFreeItem (Pntr:Pointer);
function GetConnection (Ind:Integer):TMixerConnection;
function GetCount:Integer;
public
constructor Create (AMixer:TAudioMixer;AData:TMixerLine);
destructor Destroy; override;
property Connection[Ind:Integer]:TMixerConnection read GetConnection; default;
property Count:Integer read GetCount;
end;

TMixerDestination=class(TObject)
private
XMixer:TAudioMixer;
FData:TMixerLine;
FControls:TMixerControls;
FConnections:TMixerConnections;
public
constructor Create (AMixer:TAudioMixer;AData:TMixerLine);
destructor Destroy; override;
property Connections:TMixerConnections read FConnections;
property Controls:TMixerControls read FControls;
property Data:TMixerLine read FData;
end;

TMixerDestinations=class(TObject)
private
FDestinations:TPointerList;
protected
function GetDestination (Ind:Integer):TMixerDestination;
procedure DoFreeItem (Pntr:Pointer);
function GetCount:Integer;
public
constructor Create (AMixer:TAudioMixer);
destructor Destroy; override;
property Count:Integer read GetCount;
property Destination[Ind:Integer]:TMixerDestination read GetDestination; default;
end;

TAudioMixer = class(TComponent)
private
XWndHandle:HWnd;

FDestinations:TMixerDestinations;
FMixersCount:Integer;
FMixerHandle:HMixer;
FMixerID:Integer;
FMixerCaps:TMixerCaps;
FOnLineChange:TMixerChange;
FOnControlChange:TMixerChange;
protected
procedure SetMixerID (Value:Integer);
procedure MixerCallBack (var Msg:TMessage);
procedure CloseMixer;
published
constructor Create (AOwner:TComponent); override;
destructor Destroy; override;
property MixerID:Integer read FMixerID write SetMixerID;
{Opened mixer - value must be in range 0..MixersCount-1
If no mixer is opened this value is -1}
property OnLineChange:TMixerChange read FOnLineChange write FOnLineChange;
property OnControlChange:TMixerChange read FOnControlChange write FOnControlChange;
public
function GetVolume (ADestination,AConnection:Integer;var LeftVol,RightVol,Mute:Integer;var VolDisabled,MuteDisabled:Boolean):Boolean;
{This function return volume of selected Destination and Connection.
ADestination must be from range 0..Destinations.Count-1
AConnection must be in range 0..Destinations[ADestination].Connections.Count-1
If you want to read master volume of some Destination, you have to
set AConnection to -1.
If LeftVol, RightVol or Mute is not supported by queried connection,
it's return value will be -1.

LeftVol and RightVol are in range 0..65536

If Mute is non-zero then the connection is silent.
If specified line is recording source then Mute specifies if programs will
record from this connection (it is copy of "Select" Checkbox in
standard Windows Volume Control program)
VolDisabled or MuteDisabled is True when you cannot apply settings to this
control (but can read it).

Return value of the function is True if no error has occured,
otherwise it returns False.}
function SetVolume (ADestination,AConnection:Integer;LeftVol,RightVol,Mute:Integer):Boolean;
{This function sets volume.
If you set RightVol to -1 and connection is stereo then LeftVol will be
copied to RightVol.
If LeftVol or Mute is -1 then this value will not be set.

Return value is True if ADestination and AConnection ar correct, otherwise False.}
property Destinations:TMixerDestinations read FDestinations;
{Ind must be in range 0..DestinationsCount-1}
property MixerCaps:TMixerCaps read FMixerCaps;
property MixerCount:Integer read FMixersCount;
{Number of mixers present in system; mostly 1}
property MixerHandle:HMixer read FMixerHandle;
{Handle of opened mixer}
end;

procedure Register;

implementation

{------------}
{TPointerList}
{------------}

constructor TPointerList.Create;
begin
items:=tlist.create;
end;

destructor TPointerList.Destroy;
begin
Clear;
items.destroy;
end;

procedure TPointerList.Add (Pntr:Pointer);
begin
items.add(Pntr);
end;

function TPointerList.GetPointer (Ind:Integer):Pointer;
begin
result:=items[Ind];
end;

procedure TPointerList.Clear;
var i:integer;
begin
for i:=0 to items.count-1 do begin
If Assigned (FOnFreeItem) then
FOnFreeItem (items[i])
end;
items.clear;
end;

function TPointerList.GetCount:Integer;
begin
result:=items.count;
end;

{--------------}
{TMixerControls}
{--------------}

constructor TMixerControls.Create (AMixer:TAudioMixer;AData:TMixerLine);
var MLC:TMixerLineControls;
A,B:Integer;
P:PMixerControl;
begin
FControls:=TPointerList.Create;
MLC.cbStruct:=SizeOf(MLC);
MLC.dwLineID:=AData.dwLineID;
MLC.cControls:=AData.cControls;
MLC.cbmxctrl:=SizeOf(TMixerControl);
GetMem (P,SizeOf(TMixerControl)*AData.cControls);
heap:=P;
MLC.pamxctrl:=P;
A:=MixerGetLineControls(AMixer.MixerHandle,@MLC, MIXER_GETLINECONTROLSF_ALL);
If A=MMSYSERR_NOERROR then
begin
For B:=0 to AData.cControls-1 do
begin
FControls.Add (P);
Inc (P);
end;
end;
end;

destructor TMixerControls.Destroy;
begin
FControls.free;
freemem(heap);
inherited;
end;

function TMixerControls.GetControl (Ind:Integer):PMixerControl;
begin
Result:=FControls.Pointer[Ind];
end;

function TMixerControls.GetCount:Integer;
begin
Result:=FControls.Count;
end;



---------
春困秋乏夏打盹,睡不醒的冬三月 ^^!
CDSoftwareWj 2003-10-21
  • 打赏
  • 举报
回复
unit AMixer;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
MMSystem;

(*
* TAudioMixer v1.11 (FREEWARE component)
* -----------------
* Released 4 Jan 1999
*
* This component can cache data from audio mixer. It has direct support for
* getting/setting volume of any control (It can set also set state of that
* "Selected" CheckBox in standard Windows Volume Control program). You can
* better use other features of mixer, but that's more difficult than volume
* setting and you must know something about audio mixer.
*
* The mixer has following structure (as it is in this component) :
*
* Destinations (destinations should be for example: Playback, Recording and Voice commands)
* |
* |--Destination[0] (if you want to get volume of this call GeVolume (<ThisDestinationNum>,-1,...))
* | | (=0) ----
* | |--Data:TMixerLine
* | |--Controls (controls of the line, ex: Master volume, master mute)
* | | |
* | | |--Control[0]
* | | |--Control[1]
* | | |--Control[..]
* | |
* | |--Connections (ex: Wave, MIDI, CD Audio, Line-In,...)
* | |
* | |--Connection[0] (GetVolume (<ThisDestinationNum>,<ThisConnectionNumb>,...))
* | | | (=0) (=0)
* | | |--Data:TMixerLine
* | | |--Controls (here can be volume and mute)
* | | |
* | | |--Control[0]
* | | |--Control[1]
* | | |--Control[..]
* | |
* | |--Connection[1]
* | |--Connection[..]
* |
* |--Destination[1]
* |--Destination[..]
*
*
* There are many types of controls - checkbox, list, slider,... they are
* described in Windows help. Common ones are volume slider, mute checkbox or
* volume meter.
*
* This component is universal, so you can work with all controls through it,
* but this is difficult. You can simply get/set volume level by procedures
* GetVolume or SetVolume (description is near their declaration; use - see
* example program).
*
*
* What's New
* ----------
* 1.11 (4 Jan 1999)
* - now it supports also MIXERCONTROL_CONTROLTYPE_MUX flag
* (I got SB Live! for Christmas (:-)) and my component didn't work
* properly, this corrects that problem)
* 1.1 (16 Nov 1998)
* - made compatible with Delphi 4
* - corrected memory leaks (by Ishida Wataru)
* - some another minor changes (by Ishida Wataru)
* - added another example
* - added AMixer.dcr
* 1.0 (18 Aug 1998)
* - initial version
*
*
* You can use this component freely in your programs. But if you do so, please
* send me an e-mail. I would like to know if it is useful.
*
* ?Vit Kovalcik
*
* e-mail: vkovalcik@iname.com
* WWW: http://www.geocities.com/SiliconValley/Hills/1335/
*)

{Note:
When no mixer is present TAudioMixer.Destinations will be nil.
If you then check Destinations.Count it will raise exception,
so be sure to check TAudioMixer.MixerCount first.}

type
TAudioMixer=class;

TPListFreeItemNotify=procedure (Pntr:Pointer) of object;
TMixerChange=procedure (Sender:TObject;MixerH:HMixer;ID:Integer) of object;
{MixerH is handle of mixer, which sent this message.
ID is ID of changed item (line or control).}

TPointerList=class(TObject)
private
FOnFreeItem:TPListFreeItemNotify;
Items:Tlist;
protected
function GetPointer (Ind:Integer):Pointer;
function GetCount :integer;
public
constructor Create;
destructor Destroy; override;
procedure Clear;
procedure Add (Pntr:Pointer);
property Count:Integer read GetCount;
property Pointer[Ind:Integer]:Pointer read GetPointer; default;
property OnFreeItem:TPListFreeItemNotify read FOnFreeItem write FOnFreeItem; end;

TMixerControls=class(TObject)
private
heap:pointer;
FControls:TPointerList;
protected
function GetControl (Ind:Integer):PMixerControl;
function GetCount:Integer;
public
constructor Create (AMixer:TAudioMixer;AData:TMixerLine);
destructor Destroy; override;
property Control[Ind:Integer]:PMixerControl read GetControl; default;
property Count:Integer read GetCount;
end;

TMixerConnection=class(TObject)
private
XMixer:TAudioMixer;
FData:TMixerLine;
FControls:TMixerControls;
public
constructor Create (AMixer:TAudioMixer;AData:TMixerLine);
destructor Destroy; override;
property Controls:TMixerControls read FControls;
property Data:TMixerLine read FData;
end;



---------
春困秋乏夏打盹,睡不醒的冬三月 ^^!
boatzm 2003-10-21
  • 打赏
  • 举报
回复
……这也太长了吧! : )

先看看再说哈
boatzm 2003-10-20
  • 打赏
  • 举报
回复
vagerent(哪天我打电话给她) :

先谢了哈。
不好意思,看了一下,没找到 控制声音的东东。是再Unit1 中吧
(有点乱) :)
vagerent 2003-10-18
  • 打赏
  • 举报
回复
源代码我给你发过去了,其中用了第三方控件(没关系,只是系统托盘的),看看我的代码,里面很全,包括音控,拖拽播放等等很多
boatzm 2003-10-18
  • 打赏
  • 举报
回复
好像上面的程序 ,控制不了?!!急?!!有谁有源码?

给小弟看看?squirrelzm@xinhuanet.com
tiexinliu 2003-10-18
  • 打赏
  • 举报
回复
用v来表示音
量的大小,这是个32位的整数,高16位表示右声道的音量,低16位表示左声道
shl表示左移
可以修改jar软件的分辨率 ava手机游戏软件改键位改触屏键终极教程和软件 现在很多的触摸屏手机没有数字键。很多需要数字键的JAVA软件和游戏就无法应付了,难道这样的游戏我们就放弃了?no,no,no。下面我们就介绍使用手机伴侣HandyPartner软件的改键改触屏的方法,理论适合支持JAVA的触屏手机。 早期的改键需要了解Java,要进行反编译才可以改键,一个反编译就把大家挡在了改键的门外。不过经过各位DX的努力,开发出各种傻瓜式的改键软件,通过简单的设置即可实现改键,这里我们使用的软件是HandyPartner。 另外还有其它的改键软件,比如halo,但稍稍麻烦一点,这里就不用它了。S908本身有7个按键,其中挂机键,主菜单键和照相键无法应用到JAVA程序里面。可用的只有4个加上本教程的方法,最终可以使用13个按键。好了,废话不多进入正题。 HandyPartner触屏按键教程 1.打开软件,先设置基本配置,如图 2.由于软件现在还不是很完善,没有表明键值所对应的按键,我把对应的按键标在图片上了。如图 3.明一下。 在键值转换设定里面的转换键值栏里面更改物理按键键值,将需要更改的改成手机上现有按键的键值。比如原软件要在S908上使用还缺少“#”和“*”键,但是不需要音量加和音量减键,我们就可以用S908上的音量加和音量减键代替“#”和“*”键。通过键值测试我们可知,S908的音量加键的键值是-1音量减键的键值是-2那我们就在1和2栏的转换键值里面分别填上-1 -2然后运行转换即可。 在触摸屏设置里面可以对不支持触摸屏的软件添加触摸键(注意:原程序支持触摸屏的话该软件是不能转换的。)在这里,我们可以添加任意9个按键。只需要填入对应的键值就是了。 4.很快就转换完毕,需要注意的是,文件的输出路径是HandyPartner程序文件夹里,名字默认为pkg_new.jar,所以转换完后要及时更名。 5.改完后传到手机里试一下,没有问题。 注:还是有失败的可能,除了软件问题可能还有游戏本身的问题,如果失败可以换一个游戏版本试试,实在不行也没有办法。 结束语 触摸屏所常用的改键软件就这个了,虽然不是所有的软件都可以成功改键,不过多数游戏都可以,如果你找到自己喜欢的游戏/软件,又为缺少游戏/软件按键而烦恼的话,以上的教程应该可以满足你的愿望。到时有好玩的游戏/软件一定要分享给大家呦。 另外有些软件需要改兼容什么的,那种就要用JavaMagic这个软件,这个软件教程很多。这里就不细了。 原文链接:http://www.lt163.com/jc/mtk/xxx/200906/6119.html 山寨JAVA游戏《触摸屏》控制修改软件两款及简略教程 http://bbs.shanzhaiji.cn/viewthread.php?tid=4302&extra=page=2 java游戏修改键位及其修改非触摸屏游戏为全触摸屏游戏的软件   ChMobileKey是一款可以修改JAVA游戏键位的软件,最大的好处就是能为我们这些没有键盘的机器在触摸屏上实现控制的强大软件。 使用方法:   1软件:ChMobileKey   软件主界面主要三个部份组成:“键值转换设定”是修改硬键盘的、“GetGameAction设定”(我也不清楚是搞什么的)以及“触摸屏设定”是修改触摸屏的(废话)。点一下“缺省设置”,空白的地方就被填满了。   2:键值转换设定区“原键值”的1-12分别代表手机键盘的#、*、0-9、13-14代表左右软键。需要转换哪个就在“转换键值"那对应修改  重点部分:本帖主要重点是在对触摸屏键位的增加,那就重点触摸屏的修改,打开软键ChMobileKey后在右手边看到屏幕设定能见到把屏幕分成9个格(9宫格),代表我们能在触摸屏增加9个健,修改转换前可以先用(手机的键码jar)测试自己手机的键码。同理,每个格的数值对应键盘的每个键,需要在屏幕哪个位置增加哪个键就修改哪个就改哪的个值(对应原键值的数值修改,1-12分别代表手机键盘的#、*、0-9、13-14代表左右软键),比如我们要在屏幕中间增加一个”#“键,就只需要把原有的53改成35.然后点”运行转换“,选定要转换的JAVA游戏,就能生成改好触摸键的JAVA游戏了。 PS:有部分JAVA游戏用其他修改过的是修改不了的,安装后会提示出错。但是只要能找到没有修改过的原JAVA文件来修改应该是没问题的。 注意:每次修改后的文件是自动覆盖在(触摸及键位设置)文件夹下的(pkg_new.jar)文件中的,请修改好后复制pkg_new.jar到你需要的文件夹,并且修改文件名称,但后缀.jar不要改动。 另外,请尽量用没有被修改过的原始java游戏进行测试,这样可以提高成功的概率。 还有就是JavaMagic的用法和ChMobileKey差不多,不过只能修改键盘的键位,没有触摸屏修改功能,有些游戏修改不了的,可以先用JavaMagic修改再用ChMobileKey,或许就能成功了。愿大家一起分享PPC给我们带来的乐趣。 改键后对游戏运行没有任何影响并且可以映射硬键盘 软件使用的小技巧和注意事项:ChMobileKey无法修改JM改过的文件或者已经支持触屏的文件,但是JM可以修改ChMobileKey改过的文件,所以,有些使用ChMobileKey修改但无法使用的游戏,可以试试再用JM转换,没准就能运行了
前言: Avago(安华高)的ACPL-k30T是一款专为高压MOSFET驱动定制的光电MOSFET驱动器件。该器件包含一个AlGaAs红外LED输入级,通过光学手段耦合到输出检测电路。检测电路包含了一个光电二极管阵列与关断电路。当输入LED流过最小10mA电流时光电驱动电路就会打开。只需要0.8V或是更低的输入电压就能关断光电驱动。 本文介绍的是基于TI的3个TLC5940(16路LED驱动芯片),5V开关电源,一个PIC单片机(带USB通信功能),16个高亮度RGB LED制作而成的RGB LED音量计量器。该设计实际就是我们播放器上面显示的那个EQ条,这个表通过USB与上位机(window7 或 vista系统)连接。能用LED实时显示当前声音的电平。 音量电平表实物截图: 音量电平表电路截图: 注意: 这个电路中唯一值得留心的地方就是电路图中靠近晶振的两个大电容。当TLC5940以PWM调光的方式驱动LED时,由于高速高速开关切换,产生很多噪声,而这两个电容有助于降低噪声。如果没有它们或许你的PIC单片机会重启,或者发生其他糟糕的事。 3片TLC5940级联,因此这些LED并非以复用的方式连接,每一个LED都是直接受控制的。当然,也可以把代码加以修改移植,使其能工作在LED控制复用的状态下。 固件(Firmware): 这个固件是基于一个作者开发的软件。链接如下: https://www.waitingforfriday.com/index.php/Open_Source_Framework_for_USB_Generic_HID_devices_based_on_the_PIC18F_and_Windows 作者在这个软件的基础之上加了两层,底层是TLC5940的驱动库,TLC5940是一个16通道的,支持4096级亮度(基于PWM方式,且各通道亮度独立)的LED驱动芯片。这个驱动库支持单片TLC5940,或者你可以将多片级联。理论上来,你可以通过一片PIC单片机控制(PIC单片机是连接PC机与TLC5940的桥梁)20片TLC5940(意味着你总共有16*20=320个LED),作者这里级联了三片TLC5940(共计48通道,16个RGB LED)。 顶层则是RGB LED控制,这一层通过TLC5940驱动库实现。包括的功能有LED淡入淡出,颜色平衡,和一堆相当有用的用来控制LED的功能。USB控制端有两条命令,一条是上位机指定所有的LED亮度(由0~255来表示),第二条命令式用来设定所需的LED淡出时间(库文件中同样有淡入时间,但是对电平表来没有用到) 上位机软件: 上位机软件是用Visual Studio C#2010写的,兼容Windows 7 和Vista。由于使用的音频API缘故,这个上位机软件不能使用在windows XP环境下(XP不支持这个API) 这个上位机软件由三个部分组成: 开源的C#库,USB generic HID communication(就是上文提到的作者自己开发的一个软件)。 核心的音频API,由Ray Molenkamp所写的。这个API相当强大,你可以用它来抓取音轨的信息,并展示在一个LCD,或者其他USB音频控制的设备。 VU电平表显示代码,正如你所见,这个软件可以进行一堆个性化的设置,你可以设置显示阻尼(Display damping ,它跟随音乐跳跃的速率,更大的阻尼使跳跃更缓和,但是有失精准),可以设置淡出速度(fade off ),也可以设置起始和结束时的颜色(上位机自动调节中间显示时的颜色), ,还可以设置显示方式,只单向显示左右声道的平均值,从中间向两边显示两个声道,从两边向中间显示两个声道。 自己的想法: 感觉这个不是太好弄,首先,这个PIC单片机用的人估计不太多,第二作者自己以前编了一个USB上位机,是在这个基础上开发的,虽然可以找到作者的源代码,但是估计不好搞定(我没有写过上位机软件,不太了解,随便的呵呵),而且上位机还只能在Windows7或者Vista下面用。 毕竟这里PIC单片更主要的功能,个人认为不过是个USB桥接芯片作用。如果是我的话,直接用一个常用的单片机(AVR,8051)来控制TLC5940,然后用串口通信,上位机软件也写成串口通信的形式,估计简单不少,而且如果电脑没有串口,可以用串口转USB芯片解决,这样的话可能硬件上面麻烦一点,但是估计软件开发简单(哈哈,这也是我个人的看法,我对上位机软件很不熟悉)。 还有就是,它的那个TLC5940芯片比较强大,但是我淘宝了一下,貌似有点贵,十多元一片,貌似ST2221C便宜一些,几块钱,功能可以替代,但是引脚不是兼容的。。。意味着要改程序(上位机和单片机)。 结果这样一整,就完全本土化了。。
前言: 先来DSP吧,DSP就是用数值计算的方式对信号进行加工的理论和技术,它的英文原名叫digital signal processor,简称DSP,即数字信号处理器。国内做DSP收音机比较早的是凯隆,后来两德也跟进了,包括神机DE1103的新版本也采用了DSP技术。 DSP收音机方案介绍: 本次选用的是的美国Silicon Labs公司推出的高集成度AM/FM收音机芯片。 DSP原理图截图: 它的功能十分丰富,包括自动搜台、自动校准、数字调谐、自适应噪声抑制能力等。此制作为方便用的是某宝的小模块,集成了晶振和其它外围元件,有10个口引出来方便业余焊接。 控制采用单片机STC12LE5A60S2。此单片机的低压版本,可以在较低的电压下工作,方便使用一节锂电池供电。显示用的的LCD5110,此LCD能显示丰富的信息,包换信号强度,信噪比,音量,频率,电池电量等。 改变频率和音量都用一个飞梭来控制。用飞梭自带的开关来切换是调节音量还是频率,最大化地简化系统。 电路框图如图所示: DSP收音机电路工作原理分析: DSP收音机电路电路运用单片机对DSP芯片发出指令,对DSP内部寄存器进行读写(采用IIC总线方式),完成了接收模式、频率、音量等设置,再从中读出接收的状态,包括信号强度,接收信噪比等,然后将这些信息显示在LCD上面,再利用自身的AD对电池电压进行检测,计算出电池电量一同显示在LCD上面。 运用了飞梭来输入信号,默认状态飞梭是调节频率的,频率步进FM为0.1MHz,AM为9KHz。按一下飞梭进入音量调节模式,旋转飞梭即能改变音量。再按一下或者不动一定时间,会转换回频率调节模式。进入音量调节模式时,表示音量大小的数字会闪烁提示使用者此刻是音量调节模式。 电路设计了两个按键开关,一个是FM/AM模式切换的,一个是AM带宽切换的。DSP芯片处理完的信号是音频信号,利用X8003音频功率放大IC放大即可推动喇叭发出声音。 此收音机供电采用一节18650电池进行供电,充电采用4056E模块,如图6所示,充电状态红灯亮,充满后绿灯亮,如图7、图8所示。全机静态电流为40mA,比模拟方案的稍高一点,与单片机未做省电处理有关,选用低功耗的单片机静态电流应该能降到更低的水平。 DSP收音机电路截图: 视频演示: 该DSP收音机电路接收效果: 此收音机FM灵敏度很高,一根30cm的拉杆天线就能将所有强台清晰接收,比9700DX接近1M长的拉杆天线相当不相上下,对9700DX无能为力的弱电,也能清楚接收,信噪比3db.选择性上,因本地电台不多,没有相邻的电台,无法测试,但调偏0.1MHz信号强度和信噪比立马下降许多,还能听到一丝电台的声音,调偏0.2MHz就无法听到了。所以FM是完胜。AM效果就很一般了,只能收到本地强台,其它的台都淹没在噪声中,不知是算法的原因还是些芯片的特点就是这样。所以AM是9700DX完胜。 DSP收音机实物效果图: 总结: 就接收性能而言,FM接收DSP有先天的优势,模拟的要做到DSP的指标恐怕需要的成本是相当高的,AM而言,传统的模拟方式的对业余的爱好者或许是个比较理想的选择。

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi GAME,图形处理/多媒体
社区管理员
  • GAME,图形处理/多媒体社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧