Ignore:
Timestamp:
Apr 23, 2012, 2:57:12 PM (13 years ago)
Author:
chronos
Message:
  • Modified: TPlayList is now registred as component in group CoolAudio in Component pallete.
  • Added: Created placeholder component TMediaPlayer which can be switched to different audio systems in runtime without destruction/construction.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • CoolAudio/Systems/WinAPI/UAudioSystemWindows.pas

    r352 r353  
    1111
    1212type
     13
     14  { TAudioSystemWindows }
     15
    1316  TAudioSystemWindows = class(TAudioSystem)
    1417  public
    1518    PlayerIndex: Integer;
     19    function GetMediaPlayerDriverClass: TMediaPlayerDriverClass; override;
    1620  end;
    1721
     
    2125  { TPlayerWindows }
    2226
    23   TPlayerWindows = class(TPlayer)
     27  TPlayerWindows = class(TMediaPlayerDriver)
    2428  private
    2529    FHandle: HWND;
     
    4751    procedure Pause; override;
    4852    procedure Stop; override;
    49     constructor Create(AOwner: TComponent); override;
     53    constructor Create; override;
    5054    destructor Destroy; override;
    5155    property DeviceType: TMPDeviceTypes read FDeviceType write SetDeviceType;
     
    6064
    6165implementation
     66
     67{ TAudioSystemWindows }
     68
     69function TAudioSystemWindows.GetMediaPlayerDriverClass: TMediaPlayerDriverClass;
     70begin
     71  Result := TPlayerWindows;
     72end;
    6273
    6374{$IFDEF Windows}
     
    175186  Parm: TMCI_Generic_Parms;
    176187begin
    177   if FPlaying then begin
    178     CheckError(mciSendCommand(FDeviceID, mci_Pause, FFlags, Longint(@Parm)));
    179     FPlaying := False;
    180   end else begin
    181     CheckError(mciSendCommand(FDeviceID, mci_Resume, FFlags, Longint(@Parm)));
    182     FPlaying := True;
     188  if FActive then  begin
     189    if FPlaying then begin
     190      CheckError(mciSendCommand(FDeviceID, mci_Pause, FFlags, Longint(@Parm)));
     191      FPlaying := False;
     192    end else begin
     193      CheckError(mciSendCommand(FDeviceID, mci_Resume, FFlags, Longint(@Parm)));
     194      FPlaying := True;
     195    end;
    183196  end;
    184197end;
     
    188201  Parm: TMCI_Generic_Parms;
    189202begin
    190   if FPlaying then begin
     203  if FActive and FPlaying then begin
    191204    FFlags := 0;
    192205    if FUseNotify then
     
    206219end;
    207220
    208 constructor TPlayerWindows.Create(AOwner: TComponent);
     221constructor TPlayerWindows.Create;
    209222begin
    210223  inherited;
Note: See TracChangeset for help on using the changeset viewer.