Ignore:
Timestamp:
Mar 9, 2021, 9:19:49 AM (4 years ago)
Author:
chronos
Message:
  • Modified: Synced code with current trunk version.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Packages/CevoComponents/Sound.pas

    r210 r303  
    55uses
    66  UDpiControls, SysUtils, Classes, Graphics, Controls, Forms, fgl, FileUtil,
    7   StringTables, Directories
     7  StringTables, Directories, LCLType
    88  {$IFDEF WINDOWS}, MMSystem, Windows{$ENDIF}
    9   {$IFDEF LINUX}, Process, AsyncProcess{$ENDIF};
     9  {$IFDEF LINUX}, Process, AsyncProcess2{$ENDIF};
    1010
    1111type
     
    4040    constructor Create(const FileName: string);
    4141    destructor Destroy; override;
    42     procedure Play(HWND: DWORD);
     42    procedure Play(Handle: HWND);
    4343    procedure Stop;
    4444    procedure Reset;
     
    6868{$R *.lfm}
    6969
     70{$IFDEF LINUX}
    7071resourcestring
    7172  SUnableToPlay = 'PlayStyle=%s: Unable to play %s Message:%s';
    7273  SPlayCommandNotWork = 'The play command %s does not work on your system';
     74{$ENDIF}
    7375
    7476constructor TSound.Create(const FileName: string);
     
    113115begin
    114116  Result := '';
     117  // Try ffplay
     118  if (Result = '') then
     119    if (FindDefaultExecutablePath('ffplay') <> '') then
     120      Result := 'ffplay -autoexit -nodisp -loglevel quiet';
    115121  // Try play
    116   if (FindDefaultExecutablePath('play') <> '') then
    117     Result := 'play';
     122  if (Result = '') then
     123    if (FindDefaultExecutablePath('play') <> '') then
     124      Result := 'play -q';
    118125  // Try aplay
    119   if (result = '') then
     126  if (Result = '') then
    120127    if (FindDefaultExecutablePath('aplay') <> '') then
    121128      Result := 'aplay -q';
     
    136143    if (FindDefaultExecutablePath('pacat') <> '') then
    137144      Result := 'pacat -p';
    138   // Try ffplay
    139   if (Result = '') then
    140     if (FindDefaultExecutablePath('ffplay') <> '') then
    141       result := 'ffplay -autoexit -nodisp';
    142145  // Try cvlc
    143146  if (Result = '') then
    144147    if (FindDefaultExecutablePath('cvlc') <> '') then
    145       result := 'cvlc -q --play-and-exit';
     148      Result := 'cvlc -q --play-and-exit';
    146149  // Try canberra-gtk-play
    147150  if (Result = '') then
     
    155158
    156159
    157 procedure TSound.Play(HWND: DWORD);
     160procedure TSound.Play(Handle: HWND);
    158161{$IFDEF WINDOWS}
    159162var
     
    169172  if FDeviceID <> 0 then
    170173  begin
    171     PlayParm.dwCallback := HWND;
     174    PlayParm.dwCallback := Handle;
    172175    mciSendCommand(FDeviceID, MCI_PLAY, MCI_NOTIFY, DWORD_PTR(@PlayParm));
    173176  end
     
    217220      end;
    218221    finally
    219       L.Free;
     222      FreeAndNil(L);
    220223    end;
    221224  end
Note: See TracChangeset for help on using the changeset viewer.