type
prMixerChange = 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).}
TAudioMixer = class(TComponent)
private
FWndHandle : HWnd;
.....
protected
procedure MixerCallBack(var Msg: TMessage); dynamic;
.....
constructor TAudioMixer.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FWndHandle := 0;
if not (csDesigning in ComponentState) then
FWndHandle := AllocateHWnd(MixerCallBack);
end; { TAudioMixer.Create }
destructor TAudioMixer.Destroy;
begin
if not (csDesigning in ComponentState) and (FWndHandle <> 0) then
DeAllocateHwnd(FWndHandle);
inherited;
end; { TAudioMixer.Destroy }
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);
else
Msg.Result := DefWindowProc(FWndHandle, Msg.Msg, Msg.WParam, Msg.LParam);
end;
end; { TAudioMixer.MixerCallBack }