Skip to content

Commit

Permalink
Fix audioFormat parsing breaking with DSD files
Browse files Browse the repository at this point in the history
  • Loading branch information
Difegue committed Mar 28, 2024
1 parent 2b0ef11 commit 95eb2be
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Sources/MpcNET/Commands/Status/StatusCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ public MpdStatus Deserialize(SerializedResponse response)
break;
case AudioText:
var audioFormat = value.Split(':');

if (audioFormat.Length == 2)
{
// Weird edge case with DSD files where the audio format is "dsd64:(channels)"
audioSampleRate = 0;
audioBits = 0;
int.TryParse(audioFormat[1], out audioChannels);
break;
}

int.TryParse(audioFormat[0], out audioSampleRate);
int.TryParse(audioFormat[1], out audioBits);
int.TryParse(audioFormat[2], out audioChannels);
Expand Down

0 comments on commit 95eb2be

Please sign in to comment.