Exemplo n.º 1
0
        public override IEnumerable <Issue> GetIssues(BeatmapSet aBeatmapSet)
        {
            string audioPath = aBeatmapSet.GetAudioFilePath();
            string audioName = aBeatmapSet.GetAudioFileName();

            if (audioPath != null)
            {
                ManagedBass.ChannelType actualFormat = 0;
                Exception exception = null;
                try
                { actualFormat = Audio.GetFormat(audioPath); }
                catch (Exception ex)
                { exception = ex; }

                if (exception != null)
                {
                    yield return(new Issue(GetTemplate("Exception"), null,
                                           audioName, exception.Message));
                }

                if ((ManagedBass.ChannelType.MP3 & actualFormat) == 0)
                {
                    yield return(new Issue(GetTemplate("Incorrect Format"), null,
                                           audioName, Audio.EnumToString(actualFormat)));
                }
                else if (!audioName.EndsWith(".mp3"))
                {
                    yield return(new Issue(GetTemplate("Incorrect Extension"), null,
                                           audioName, Audio.EnumToString(actualFormat)));
                }
            }
        }
Exemplo n.º 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")));
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        public override IEnumerable <Issue> GetIssues(BeatmapSet beatmapSet)
        {
            string audioPath = beatmapSet.GetAudioFilePath();
            string audioName = beatmapSet.GetAudioFileName();

            if (audioPath == null)
            {
                yield break;
            }

            ManagedBass.ChannelType actualFormat = 0;
            Exception exception = null;

            try
            {
                actualFormat = AudioBASS.GetFormat(audioPath);
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            if (exception != null)
            {
                yield return(new Issue(GetTemplate("Exception"), null,
                                       audioName, Common.ExceptionTag(exception)));
            }

            else if ((ManagedBass.ChannelType.MP3 & actualFormat) != ManagedBass.ChannelType.MP3 &&
                     (ManagedBass.ChannelType.OGG & actualFormat) != ManagedBass.ChannelType.OGG)
            {
                yield return(new Issue(GetTemplate("Incorrect Format"), null,
                                       audioName, AudioBASS.EnumToString(actualFormat)));
            }

            else if (!audioName.ToLower().EndsWith(".mp3") && (ManagedBass.ChannelType.MP3 & actualFormat) == ManagedBass.ChannelType.MP3)
            {
                yield return(new Issue(GetTemplate("Incorrect Extension"), null,
                                       audioName, AudioBASS.EnumToString(actualFormat), ".mp3"));
            }

            else if (!audioName.ToLower().EndsWith(".ogg") && (ManagedBass.ChannelType.OGG & actualFormat) == ManagedBass.ChannelType.OGG)
            {
                yield return(new Issue(GetTemplate("Incorrect Extension"), null,
                                       audioName, AudioBASS.EnumToString(actualFormat), ".ogg"));
            }
        }