Skip to content

Commit

Permalink
Fix SMPTE time divisions not being read/written correctly (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNathannator committed Oct 8, 2023
1 parent ddc55c4 commit 5f585a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DryWetMidi/Core/TimeDivision/SmpteTimeDivision.cs
Expand Up @@ -79,7 +79,7 @@ public SmpteTimeDivision(SmpteFormat format, byte resolution)

internal override short ToInt16()
{
return (short)-DataTypesUtilities.Combine((byte)Format, Resolution);
return (short)DataTypesUtilities.Combine((byte)-(byte)Format, Resolution);
}

/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions DryWetMidi/Core/TimeDivision/TimeDivisionFactory.cs
Expand Up @@ -10,8 +10,7 @@ internal static TimeDivision GetTimeDivision(short division)
{
if (division < 0)
{
division = (short)-division;
return new SmpteTimeDivision((SmpteFormat)division.GetHead(), division.GetTail());
return new SmpteTimeDivision((SmpteFormat)(-division.GetHead()), division.GetTail());
}

return new TicksPerQuarterNoteTimeDivision(division);
Expand Down

0 comments on commit 5f585a7

Please sign in to comment.