Einzelnen Beitrag anzeigen

Wishmaster

Registriert seit: 14. Sep 2002
Ort: Steinbach, MB, Canada
301 Beiträge
 
Delphi XE2 Architect
 
#3

AW: Balance mit Bass

  Alt 1. Feb 2012, 23:16
Delphi-Quellcode:
(********************************* Set Volume *********************************)
(*
plVolume Value (0..100)
plBalance Value (-100..0..100)
*)


function TFilePlayer.Player_Set_Volume(Value : Integer; Mode : TPlayerVolume) : Boolean;
var Vol : Float;
    Tmp : integer;
begin
  tmp:= value;

 case Mode of
   plVolume :
               begin
                 if Tmp < 0 then Tmp:= 0;
                 if Tmp > 100 then Tmp:= 100;
                 Vol:= tmp / 100.0;
                 Result:= BASS_ChannelSetAttribute(Chan_Source, BASS_ATTRIB_VOL, Vol);
                if Result then
                 begin
                  FChannelVol:= Value;
                  FChannelMute:= False;
                 end;
               end;
   plBalance :
               begin
                if Tmp < -100 then Tmp:= -100;
                if Tmp > 100 then Tmp:= 100;
                Vol:= Tmp / 100.0;
                 Result:= BASS_ChannelSetAttribute(Chan_Source, BASS_ATTRIB_PAN, Vol);
                if Result then
                 begin
                  FChannelPan:= Value;
                 end;
               end;
 end;
end;

(********************************* Get Volume *********************************)

function TFilePlayer.Player_Get_Volume(var Value : Integer; Mode : TPlayerVolume) : Boolean;
var Vol : Float;
begin
 case Mode of
   plVolume :
               begin
                 Result:= BASS_ChannelGetAttribute(Chan_Source, BASS_ATTRIB_VOL, Vol);
                if Result then
                 Value:= Round(Vol * 100)
                else
                 Value:= 0;
               end;
   plBalance :
               begin
                 Result:= BASS_ChannelGetAttribute(Chan_Source, BASS_ATTRIB_PAN, Vol);
                if Result then
                 Value:= Round(Vol * 100)
                else
                 Value:= 0;
               end;
 end;
end;
  Mit Zitat antworten Zitat