Skip to content

Commit

Permalink
Export, Trackgain: Empty string instead of 0.0000
Browse files Browse the repository at this point in the history
  • Loading branch information
mail@gausi.de authored and mail@gausi.de committed Dec 3, 2022
1 parent e7afe00 commit 00e9a36
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/AudioDisplayUtils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@ function GetAudioProperty(aAudioFile: TAudioFile; aProp: TEAudioProperty): strin
cpLyrics : result := aAudioFile.Lyrics;
cpLyricsExist : if aAudioFile.LyricsExisting then result := '1' else result := '0';
cpBPM : result := aAudioFile.BPM;
cpTrackGain : result := PeakValueToString(aAudioFile.TrackGain);
cpAlbumGain : result := PeakValueToString(aAudioFile.AlbumGain);
cpTrackGain : result := GainValueToNumberString(aAudioFile.TrackGain);
cpAlbumGain : result := GainValueToNumberString(aAudioFile.AlbumGain);
cpTrackPeak : result := PeakValueToString(aAudioFile.TrackPeak);
cpAlbumPeak : result := PeakValueToString(aAudioFile.AlbumPeak);
cpCoverID : result := aAudioFile.CoverID;
Expand Down
17 changes: 17 additions & 0 deletions src/Hilfsfunktionen.pas
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ function GainStringToSingle(aGainString: String): Single;
function PeakStringToSingle(aPeakString: String): Single;

function GainValueToString(aGainValue: Single): String;
function GainValueToNumberString(aGainValue: Single): String;
function PeakValueToString(aPeakValue: Single): String;

function AnsiCompareText_Nemp(const S1, S2: string): Integer;
Expand Down Expand Up @@ -763,6 +764,22 @@ function GainValueToString(aGainValue: Single): String;
end;
end;

function GainValueToNumberString(aGainValue: Single): String;
var formatSettings: TFormatSettings;
begin
if isZero(aGainValue) then
result := ''
else
begin
formatSettings := TFormatSettings.Create(GetThreadLocale);
formatSettings.DecimalSeparator := '.';
if aGainValue > 0 then
result := Format('+%.6f', [aGainValue], formatSettings)
else
result := Format('%.6f', [aGainValue], formatSettings);
end;
end;

function PeakValueToString(aPeakValue: Single): String;
var formatSettings: TFormatSettings;
begin
Expand Down

0 comments on commit 00e9a36

Please sign in to comment.