public override IEnumerable <Issue> GetIssues(BeatmapSet aBeatmapSet) { if (aBeatmapSet.GetAudioFilePath() != null) { foreach (Issue issue in GetIssue(aBeatmapSet, aBeatmapSet.GetAudioFilePath())) { yield return(issue); } } foreach (string hitSoundFile in aBeatmapSet.hitSoundFiles) { string hitSoundPath = Path.Combine(aBeatmapSet.songPath, hitSoundFile); ManagedBass.ChannelType hitSoundFormat = Audio.GetFormat(hitSoundPath); if ((hitSoundFormat & ManagedBass.ChannelType.OGG) == 0 || (hitSoundFormat & ManagedBass.ChannelType.MP3) == 0) { // Hit sounds only need to follow the lower limit for quality requirements, as // Wave (which is the most used hit sound format currently) is otherwise uncompressed anyway. foreach (Issue issue in GetIssue(aBeatmapSet, hitSoundPath, true)) { yield return(issue); } } } }
public override IEnumerable <Issue> GetIssues(BeatmapSet beatmapSet) { if (beatmapSet.GetAudioFilePath() != null) { foreach (Issue issue in GetIssue(beatmapSet, beatmapSet.GetAudioFilePath())) { yield return(issue); } } foreach (string hitSoundFile in beatmapSet.hitSoundFiles) { string hitSoundPath = Path.Combine(beatmapSet.songPath, hitSoundFile); ManagedBass.ChannelType hitSoundFormat = AudioBASS.GetFormat(hitSoundPath); if ((hitSoundFormat & ManagedBass.ChannelType.OGG) != 0 && (hitSoundFormat & ManagedBass.ChannelType.MP3) != 0) { continue; } foreach (Issue issue in GetIssue(beatmapSet, hitSoundPath, true)) { yield return(issue); } } }
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))); } } }
public override IEnumerable <Issue> GetIssues(BeatmapSet beatmapSet) { if (beatmapSet.GetAudioFilePath() != null) { foreach (var issue in GetIssue(beatmapSet, beatmapSet.GetAudioFilePath())) { yield return(issue); } } foreach (string hitSoundFile in beatmapSet.hitSoundFiles) { string hitSoundPath = Path.Combine(beatmapSet.songPath, hitSoundFile); ManagedBass.ChannelType hitSoundFormat = 0; Issue errorIssue = null; try { hitSoundFormat = AudioBASS.GetFormat(hitSoundPath); } catch (Exception exception) { errorIssue = new Issue(GetTemplate("Exception"), null, PathStatic.RelativePath(hitSoundPath, beatmapSet.songPath), Common.ExceptionTag(exception)); } if (errorIssue != null) { yield return(errorIssue); continue; } if ((hitSoundFormat & ManagedBass.ChannelType.OGG) != 0 && (hitSoundFormat & ManagedBass.ChannelType.MP3) != 0) { continue; } foreach (var issue in GetIssue(beatmapSet, hitSoundPath, true)) { yield return(issue); } } }
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"))); } } } } }
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")); } }