1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-28 02:25:29 +08:00

Remove BassFlags.Prescan and free the decodeStream

This commit is contained in:
Arthur Araujo
2024-04-17 08:14:19 -03:00
Unverified
parent c32d99250f
commit 8d94f8d995
2 changed files with 7 additions and 4 deletions
@@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Edit.Checks
continue;
var fileCallbacks = new FileCallbacks(new DataStreamFileProcedures(data));
int decodeStream = Bass.CreateStream(StreamSystem.NoBuffer, BassFlags.Decode | BassFlags.Prescan, fileCallbacks.Callbacks, fileCallbacks.Handle);
int decodeStream = Bass.CreateStream(StreamSystem.NoBuffer, BassFlags.Decode, fileCallbacks.Callbacks, fileCallbacks.Handle);
// If the format is not supported by BASS
if (decodeStream == 0)
@@ -61,9 +61,10 @@ namespace osu.Game.Rulesets.Edit.Checks
var audioInfo = Bass.ChannelGetInfo(decodeStream);
if (!allowedFormats.Contains(audioInfo.ChannelType))
{
yield return new IssueTemplateIncorrectFormat(this).Create(file.Filename, audioInfo.ChannelType.ToString());
}
Bass.StreamFree(decodeStream);
}
}
}
@@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Edit.Checks
if (data == null || data.Length <= 0) yield break;
var fileCallbacks = new FileCallbacks(new DataStreamFileProcedures(data));
int decodeStream = Bass.CreateStream(StreamSystem.NoBuffer, BassFlags.Decode | BassFlags.Prescan, fileCallbacks.Callbacks, fileCallbacks.Handle);
int decodeStream = Bass.CreateStream(StreamSystem.NoBuffer, BassFlags.Decode, fileCallbacks.Callbacks, fileCallbacks.Handle);
// If the format is not supported by BASS
if (decodeStream == 0)
@@ -55,6 +55,8 @@ namespace osu.Game.Rulesets.Edit.Checks
if (!allowedFormats.Contains(audioInfo.ChannelType))
yield return new IssueTemplateIncorrectFormat(this).Create(audioFile.Filename, audioInfo.ChannelType.ToString());
Bass.StreamFree(decodeStream);
}
}