Anders429 / simfile

Apache License 2.0
0 stars 0 forks source link

Read and write .msd files. #41

Closed Anders429 closed 2 years ago

Anders429 commented 2 years ago

This PR switches over to the msd library for reading the MSD-style tags, and provides an entire implementation of reading and writing .msd simfiles. This resolves #15 and #34, and checks off a few boxes on #5.

This is a significant rewrite of the library, but I think it is worth it. The msd library is a much better solution than trying to implement a parser here in this library. Instead of parsing it ourselves, serde and msd can parse it all for us, with the added benefits of serde's support for standard types.

The overall strategy in this PR is to define a central Song struct (as before), and a separate Song struct for each file format. From implementations are also defined, making it straightforward to convert between the central Song and the file format-specific Song. Serialization and Deserialization implementations are also provided for the file format Song, allowing for easy writing and reading from the files directly. Ultimately, this should make for some easy transcoding between simfiles, which is one of the main goals of the library.

Anders429 commented 2 years ago

A couple of things that need to be done before merging this:

codecov-commenter commented 2 years ago

Codecov Report

Merging #41 (7cb7c5d) into master (77af687) will increase coverage by 2.52%. The diff coverage is 99.55%.

@@            Coverage Diff             @@
##           master      #41      +/-   ##
==========================================
+ Coverage   95.89%   98.42%   +2.52%     
==========================================
  Files           3        4       +1     
  Lines         195     3868    +3673     
==========================================
+ Hits          187     3807    +3620     
- Misses          8       61      +53     
Impacted Files Coverage Δ
src/lib.rs 100.00% <ø> (ø)
src/song/msd.rs 98.27% <ø> (ø)
src/song/mod.rs 96.29% <95.45%> (+96.29%) :arrow_up:
src/song/util.rs 99.76% <99.76%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us.

Anders429 commented 2 years ago

This PR will also close #38, since msd has location-aware error messages.

Anders429 commented 2 years ago

This PR also defines the crate's MSRV, fixing #11.

Anders429 commented 2 years ago

While there still are a few rough edges (hemiolas in generic doubles to msd doubles conversion, for example), I'd say this PR is ready to go. As said before, this basically restructures the entire crate (although there luckily wasn't much to be lost prior to this, as most existing work was moved into the msd crate in a much more generic and scalable way), and I think it's for the better. Looking forward to moving on to .dwi files next.