Пример #1
0
        public IEnumerable <Issue> GetIssue(BeatmapSet aBeatmapSet, string audioPath, bool isHitSound = false)
        {
            string    audioRelPath = PathStatic.RelativePath(audioPath, aBeatmapSet.songPath);
            AudioFile file         = new AudioFile(audioPath);

            // gets the bitrate in bps, so turn it into kbps
            double bitrate    = file.GetAverageBitrate() / 1000;
            double minBitrate = file.GetLowestBitrate() / 1000;
            double maxBitrate = file.GetHighestBitrate() / 1000;

            if (minBitrate == maxBitrate)
            {
                if (minBitrate < 128 || (maxBitrate > 192 && !isHitSound))
                {
                    if (!isHitSound)
                    {
                        yield return(new Issue(GetTemplate("CBR"), null,
                                               audioRelPath, $"{bitrate:0.##}",
                                               (bitrate < 128 ? "low" : "high")));
                    }
                    else
                    {
                        yield return(new Issue(GetTemplate("CBR Hit Sound"), null,
                                               audioRelPath, $"{bitrate:0.##}"));
                    }
                }
            }
            else
            {
                if (bitrate < 128 || (bitrate > 192 && !isHitSound))
                {
                    if (Math.Round(bitrate) < 128 || (Math.Round(bitrate) > 192 && !isHitSound))
                    {
                        if (!isHitSound)
                        {
                            yield return(new Issue(GetTemplate("VBR"), null,
                                                   audioRelPath,
                                                   $"{bitrate:0.##}", $"{minBitrate:0.##}", $"{maxBitrate:0.##}",
                                                   (bitrate < 128 ? "low" : "high")));
                        }
                        else
                        {
                            yield return(new Issue(GetTemplate("VBR Hit Sound"), null,
                                                   audioRelPath,
                                                   $"{bitrate:0.##}", $"{minBitrate:0.##}", $"{maxBitrate:0.##}"));
                        }
                    }
                    else if (!isHitSound)
                    {
                        yield return(new Issue(GetTemplate("Exact VBR"), null,
                                               audioRelPath,
                                               $"{bitrate:0.##}", $"{minBitrate:0.##}", $"{maxBitrate:0.##}",
                                               (bitrate < 128 ? "low" : "high")));
                    }
                }
            }
        }
Пример #2
0
        public override IEnumerable <Issue> GetIssues(BeatmapSet aBeatmapSet)
        {
            if (aBeatmapSet.GetAudioFilePath() != null)
            {
                AudioFile file = new AudioFile(aBeatmapSet.GetAudioFilePath());

                // gets the bitrate in bps, so turn it into kbps
                double bitrate    = file.GetAverageBitrate() / 1000;
                double minBitrate = file.GetLowestBitrate() / 1000;
                double maxBitrate = file.GetHighestBitrate() / 1000;

                if (minBitrate == maxBitrate)
                {
                    if (minBitrate < 128 || maxBitrate > 192)
                    {
                        yield return(new Issue(GetTemplate("CBR"), null,
                                               aBeatmapSet.GetAudioFileName(), $"{bitrate:0.##}",
                                               (bitrate < 128 ? "low" : "high")));
                    }
                }
                else
                {
                    if (bitrate < 128 || bitrate > 192)
                    {
                        if (Math.Round(bitrate) < 128 || Math.Round(bitrate) > 192)
                        {
                            yield return(new Issue(GetTemplate("VBR"), null,
                                                   aBeatmapSet.GetAudioFileName(),
                                                   $"{bitrate:0.##}", $"{minBitrate:0.##}", $"{maxBitrate:0.##}",
                                                   (bitrate < 128 ? "low" : "high")));
                        }
                        else
                        {
                            yield return(new Issue(GetTemplate("Exact VBR"), null,
                                                   aBeatmapSet.GetAudioFileName(),
                                                   $"{bitrate:0.##}", $"{minBitrate:0.##}", $"{maxBitrate:0.##}",
                                                   (bitrate < 128 ? "low" : "high")));
                        }
                    }
                }
            }
        }