1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 12:22:56 +08:00

Use bitwise to check hitsound formats

This commit is contained in:
Arthur Araujo 2024-04-22 04:44:38 -03:00
parent 92b85beff6
commit 49563f4e5b

View File

@ -3,7 +3,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using ManagedBass;
using osu.Framework.Audio.Callbacks;
using osu.Game.Beatmaps;
@ -22,14 +21,6 @@ namespace osu.Game.Rulesets.Edit.Checks
new IssueTemplateIncorrectFormat(this),
};
private IEnumerable<ChannelType> allowedFormats => new ChannelType[]
{
ChannelType.WavePCM,
ChannelType.WaveFloat,
ChannelType.OGG,
ChannelType.Wave | ChannelType.OGG,
};
public IEnumerable<Issue> Run(BeatmapVerifierContext context)
{
var beatmapSet = context.Beatmap.BeatmapInfo.BeatmapSet;
@ -60,7 +51,7 @@ namespace osu.Game.Rulesets.Edit.Checks
var audioInfo = Bass.ChannelGetInfo(decodeStream);
if (!allowedFormats.Contains(audioInfo.ChannelType))
if ((audioInfo.ChannelType & ChannelType.Wave) == 0 && audioInfo.ChannelType != ChannelType.OGG)
yield return new IssueTemplateIncorrectFormat(this).Create(file.Filename);
Bass.StreamFree(decodeStream);