Ignore:
Timestamp:
Oct 4, 2011, 6:55:54 PM (13 years ago)
Author:
george
Message:
  • Fixed: Do not use Windows MMSystem unit under Linux.
  • Fixed: Floating point/comma decimal separator error.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • CoolAudio/Systems/UAudioSystemMPlayer.pas

    r277 r279  
    2525    FPath: string;
    2626    procedure SetOutputMode(AValue: TOutputDriver); override;
     27  public
    2728    function FindPath: string;
    28   public
    2929    constructor Create; override;
    3030    destructor Destroy; override;
     
    6464implementation
    6565
     66function StrToFloatPoint(Value: string): Extended;
     67var
     68  FPointSeparator: TFormatSettings;
     69begin
     70  // Format seetings to convert a string to a float
     71  FPointSeparator := DefaultFormatSettings;
     72  FPointSeparator.DecimalSeparator := '.';
     73  FPointSeparator.ThousandSeparator := '#';// disable the thousand separator
     74  Result := StrToFloat(Value, FPointSeparator);
     75end;
     76
     77function FloatPointToStr(Value: Extended): string;
     78var
     79  FPointSeparator: TFormatSettings;
     80begin
     81  // Format seetings to convert a string to a float
     82  FPointSeparator := DefaultFormatSettings;
     83  FPointSeparator.DecimalSeparator := '.';
     84  FPointSeparator.ThousandSeparator := '#';// disable the thousand separator
     85  Result := FloatToStr(Value, FPointSeparator);
     86end;
     87
    6688{ TAudioSystemMPlayer }
    6789
     
    130152    I := LastDelimiter('=', tmps);
    131153    if I > 0 then begin
    132       Tmps := StringReplace(Tmps, '.', ',', [rfReplaceAll]);
    133       Time := StrToFloat(Copy(tmps, I + 1, System.Length(tmps)));
     154      Time := StrToFloatPoint(Copy(tmps, I + 1, System.Length(tmps)));
    134155      Result := Time * OneSecond;
    135156    end;
     
    153174    I := LastDelimiter('=', tmps);
    154175    if I > 0 then begin
    155       Tmps := StringReplace(Tmps, '.', ',', [rfReplaceAll]);
    156       Time := StrToFloat(Copy(tmps, I + 1, System.Length(tmps)));
     176      Time := StrToFloatPoint(Copy(tmps, I + 1, System.Length(tmps)));
    157177      Result := Time * OneSecond;
    158178    end else Result := -1;
     
    186206begin
    187207  if FPlaying and FProcess.Running then begin
    188     SendCommand('set_property time_pos ' + StringReplace(FloatToStr(AValue / OneSecond), ',', '.', [rfReplaceAll]));
     208    SendCommand('set_property time_pos ' + FloatPointToStr(AValue / OneSecond));
    189209  end;
    190210end;
Note: See TracChangeset for help on using the changeset viewer.