Skip to content

Commit

Permalink
Fix a potential deadlock with FLAC files
Browse files Browse the repository at this point in the history
  • Loading branch information
Raymonf committed Jan 5, 2024
1 parent f540bd6 commit a37ab63
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions BAKKA_Editor/SoundEngines/BassBakkaSoundEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public IBakkaSound Play2D(Stream soundStream, bool playLooped, bool startPaused)

public IBakkaSound Play2D(string soundFilename, bool playLooped, bool startPaused)
{
// create decode channel
var decodeChannel = Bass.CreateStream(soundFilename, 0, 0, BassFlags.Decode);
// try loading as flac first to avoid the buggy flac implementation
var decodeChannel = BassFlac.CreateStream(soundFilename, 0, 0, BassFlags.Decode);
if (decodeChannel == 0 && Bass.LastError == Errors.FileFormat)
// try loading as flac if we get a file format error
decodeChannel = BassFlac.CreateStream(soundFilename, 0, 0, BassFlags.Decode);
// try loading normally if we get a file format error
decodeChannel = Bass.CreateStream(soundFilename, 0, 0, BassFlags.Decode);

if (decodeChannel == 0)
{
Expand Down

0 comments on commit a37ab63

Please sign in to comment.