public AudioMetadata GetGroupResult() => new AudioMetadata { AlbumPeak = _groupState.GroupPeak.ToString(CultureInfo.InvariantCulture), AlbumGain = (_referenceLevel - R128Analyzer.GetLoudnessMultiple(_groupState.Handles.ToArray())) .ToString(CultureInfo.InvariantCulture) };
public void Initialize(AudioInfo info, SettingDictionary settings, GroupToken groupToken) { _analyzer = new R128Analyzer((uint)info.Channels, (uint)info.SampleRate, settings.TryGetValue("PeakAnalysis", out string peakAnalysis) && peakAnalysis.Equals("Interpolated", StringComparison.Ordinal)); _groupState = (GroupState)groupToken.GetOrSetGroupState(new GroupState()); // ReSharper disable once PossibleNullReferenceException _groupState.Handles.Enqueue(_analyzer.Handle); }