1
0
mirror of synced 2024-11-24 05:30:11 +01:00
Commit Graph

314 Commits

Author SHA1 Message Date
Viv
bc21f5a31d converters.py: Improve comments in convertTJAToFumen function 2023-07-09 16:19:20 -04:00
Viv
fac814f6de converters.py: Reorder the branchStart step 2023-07-09 15:51:04 -04:00
Viv
7d9ab6f7b2 converters.py: Reorganize the metadata-adjustment steps 2023-07-09 15:51:04 -04:00
Viv
57edc7aecf Simplify how #BPMCHANGEs adjust the fumenOffset
Before:

- If there was a #BPMCHANGE, tana's adjustment would be applied to _the current measure's duration_. This would result in very strange looking, impossible durations (e.g. negative)
- Additionally, this method required us to look ahead to the _next_ measure to determine the adjustment.
- Finally, it required us to keep track of two different durations: measureDurationBase (unadjusted) and measureDuration (adjusted)

After:

- Instead, we now leave the measureDuration as purely as "unadjusted".
- Then, we apply the "BPMCHANGE adjustment" _only_ when computing the fumenOffset start of the next measure.
- This requires us to keep track of both the start *and* end fumenOffset (where end = start + duration)
- However, this greatly simplifies and clarifies the code, since we:
  - No longer need to "look ahead" to the next measure to compute the offset adjustment.
  - No longer need to keep track of two different measureDurations (adjusted/unadjusted)
  - Only need to work with a single pair of measures at a time (measureFumen, measureFumenPrev)
  - The measure duration (and fumenOffsetEnd) times are now more comprehensible, since any negative offsets are only applied to the fumenOffsetStart value of the next measure.

After:
2023-07-09 15:51:04 -04:00
Viv
5664c7c8d0 converters.py: Remove the need for measureDurationPrev 2023-07-08 19:38:29 -04:00
Viv
ab7708e740 testing/: Tighten up tolerance for fumenOffset/pos 2023-07-08 18:44:37 -04:00
Viv
7b31516438 Fix P2/2P bug and add clsca to the test suite
Fixes #13.
2023-07-08 18:44:37 -04:00
Viv
b874d5c412
Fix inaccurate method for computing the fumenOffset values for the initial measures (#28)
- Before: 'OFFSET' = 2nd measure fumenOffset
- After: ('OFFSET'-Full measure duration) = 1st measure fumenOffset

Both methods will produce the same results if no #MEASURE/#BPMCHANGE
commands are present in the first two measures. However, if these
commands ARE present, then you will get wildly different results.

This change doesn't affect 4/6 tests, but for 2/6 tests there were
#MEASURE/#BPMCHANGE commands. For these songs, I had erroneously "fixed"
the OFFSET values, when they were correct all along. So, I reverted them
back to their original values.

Fixes #25.
2023-07-06 23:38:10 -04:00
Viv
a95b8e7ab1
Add support for #DELAY commands (#24)
This PR adds support for `#DELAY` commands, and adds a fumen-TJA pair
for `linda` to test this.

Fixes #5.
2023-07-05 23:53:48 -04:00
Viv
ce633253ee
Add support for multiplayer charts (STYLE:{Single,Double}, # START {P1,P2}) (#23)
This PR adds support for multiplayer charts, and adds a new multiplayer
TJA/fumen combo for testing.

This PR is quite small, because the only work that needed to be done is
parsing the course metadata. Once the TJA lines are split into courses,
the actual course-by-course parsing logic is identical to the songs that
came before.

Fixes #6.
2023-07-05 16:03:41 -04:00
Viv
d9b1476f4d
Add remaining support for branches (#BRANCHSTART r) (#21)
This PR adds the remaining changes needed to support branching TJA
songs.

- Properly handling `r` (drumroll) based branching conditions
- Handling commands that come after a measure end but _before_ the first
`#BRANCHSTART` command. (This was not previously covered by
`hol6po.tja`.)

As well, it adds a bit of cleanup/refactoring to the changes from the
previous branch PR (#20).

To test these changes, another new branching TJA-fumen pair is added to
the test suite.
2023-07-02 00:00:36 -04:00
Viv
4e613d7237
Add partial support for branches (#BRANCHSTART P, no R, no #SECTION) (#20)
This PR adds partial branch support -- enough to correctly convert
`hol6po.tja`, but likely not enough to convert other songs.

Partially addresses #2.
2023-07-01 17:41:23 -04:00
Viv
2f934249dd converters.py: Add mid-measure support for SCROLL/GOGO
Before, I assumed that only mid-measure BPMCHANGE commands would split the measure in two. However, mid-measure SCROLL/GOGO commands *also* split the measure in two.
2023-07-01 12:30:04 -04:00
Viv
f0ff74c190 converters.py: Explicitly specify idx_m-1
For non-branching songs, `-1` == `idx_m-1`. But, for branching songs, we will repeatedly visit the same measures to populate the different branches. This means that the relative index `-1` is no longer valid.
2023-07-01 11:46:07 -04:00
Viv
e1b089a595 converters.py: Fix bug when computing the second
This bug wasn't caught because `measureDurationPrev` generally equals `measureDuration` for the first two measures.

However, if there is a BPM change within the first 3 measures, then the wrong `measureDuration` will be used. So, we need to explicitly specify `measureDurationPrev`
2023-07-01 11:44:23 -04:00
Viv
1b4a938a5e parsers.py: Properly catch shift-jis UnicodeDecodeErrors 2023-06-30 17:42:34 -04:00
Viv
e2b0ac3e50 testing/: Remove outdated comments 2023-06-30 17:37:38 -04:00
Viv
4a5a3399aa
Refactor TJA parsing code to enable the development of further features (#19) 2023-06-30 14:51:57 -04:00
Viv
1510a62bf5 tests/: Add WIP test for soul-gauge byte LUTs 2023-06-29 21:24:55 -04:00
Viv
73b1fed5a7 Standarize I/O for read/writeFumen functions 2023-06-29 20:56:34 -04:00
Viv
1ea10e0635 parsers.py: Remove byteOrder from readFumen
This is a relic of KatieFrog's old fumen2osu tool, and is not used.
2023-06-29 20:52:37 -04:00
Viv
6d2f5a73bb Add comments to TJA test files
- Documenting the purpose of each song in the test suite
- Testing that comments are handled correctly
2023-06-29 20:51:13 -04:00
Viv
c04d90d85f test_and_publish_release.yml: Use -e for first test
This isn't 100% necessary, but better reflects what should be done by devs when installing tja2fumen in their development environment.
2023-06-29 20:35:37 -04:00
Viv
2ed0f92a69 Revert "tests: Import from src.tja2fumen"
This reverts commit af91e9fe47.

I was mistaken. Importing from src is _not_ necessary to perform PyCharm coverage tests. Instead, the package must be installed in editable mode.
2023-06-29 20:34:39 -04:00
Viv
3e33d5c634 Fix errors in ia6cho charts
The official fumen had some issues where a note ended up in the wrong measure:

- Expected: pos 0.0 on the next measure
- Actual: pos 645 on the prev measure (impossible pos)

They're the same pos, but only pos 0.0 is possible to express in TJA charts, so the fumens themselves had to be updated.

Also, the TJA chart had errors, too:

- The BPMs/SCROLLs in the BPMCHANGE section were incorrect
- Some drumrolls were too short

Fixing these errors caused the failing test to pass.
2023-06-29 19:47:25 -04:00
Viv
ea701a5c63 tests/: Increase the tolerance for drumroll duration
Again, I encountered a large mismatch where an official fumen didn't land on the expected beat.
2023-06-29 19:47:25 -04:00
Viv
91ad789d10 tests/: Don't halt early if there's a len(notes) mistmatch 2023-06-29 19:47:25 -04:00
Viv
712cdc0a14 tests/: Don't halt early if there's a len(measures) mismatch 2023-06-29 19:47:25 -04:00
Viv
8b302e876f tests/: Use readable name for song variables 2023-06-29 19:47:25 -04:00
Viv
9069f462ce converters.py: Don't update SCROLL/GOGO/BARLINE right away
Instead, we should only update the values once we encounter more notes.

This prevents an issue where a command is used before a BPMCHANGE event:

#   33
#   #GOGOEND
#   #BPMCHANGE 107
#   33,

If GOGOEND is applied right away, then the first '33' notes will be affected. But, we only want the last '33' notes to be affected.
2023-06-29 19:47:25 -04:00
Viv
3f981236e3 tests/: Add sorting for generated songs
This makes things nicer to debug, since we're following an expected order.
2023-06-29 15:40:05 -04:00
Viv
305b70eb27 tests/: Compare only the non-empty measures 2023-06-29 15:39:39 -04:00
Viv
0bef98c10d Stop hardcoding song['length']
Instead, rely on len(song['measures') as the single source of truth for measures
2023-06-29 15:19:51 -04:00
Viv
6286a3a78d Reorder test functions 2023-06-29 15:19:51 -04:00
Viv
73df48c70c Remove debugPrint-related funcs 2023-06-29 14:29:12 -04:00
Viv
af91e9fe47 tests: Import from src.tja2fumen
This will _actually_ perform an in-place test run, rather than importing from the installed package. This is necessary for PyCharm's coverage to ework correctly.
2023-06-29 14:10:25 -04:00
Viv
f7209de56c .gitignore: Add __pycache__ 2023-06-29 02:02:23 -04:00
Viv
c320d4248b Move dev dependencies from GHA to pyproject.toml 2023-06-29 02:01:38 -04:00
Viv
2f06ee433c Add raises=AssertionError to ia6cho xfail entry 2023-06-29 02:01:38 -04:00
Viv
52eae95161 Increase verbosity of test suite (-v -> -vv) 2023-06-29 02:01:38 -04:00
Viv
5a1d7c9aa3 Add ia6cho to test suite as XFAIL 2023-06-29 02:01:29 -04:00
vivaria
e528f48e1d
Adapt release workflow to also act as a test suite (#18) 2023-06-29 01:20:46 -04:00
Viv
1429b8f466 Make sure LUT .csv files are included in wheel/sdist 2023-06-27 19:35:45 -04:00
Viv
88031074a6 Rename test_songs -> test_conversion 2023-06-27 18:32:35 -04:00
Viv
4a2ee1cac0 create-release.yml: Add release workflow 2023-06-26 21:12:15 -04:00
Viv
99331eeeb8 __init__.py: Fix main to vary return variables
We want to return variables during testing, but not during CLI, or else they will be printed to stderr
2023-06-26 19:56:26 -04:00
Viv
07a617ab13 setup.py: Add newline 2023-06-26 19:54:51 -04:00
Viv
7b8097ef2e converters.py: Add missing barline setting 2023-06-26 19:11:04 -04:00
Viv
26b23ece19 Use LUT-based method for soul gauge bytes
The new CSV files are lookup tables generated using the following script:
https://github.com/vivaria/tja2fumen/issues/14#issuecomment-1606418746

Fixes #14.
2023-06-25 21:54:12 -04:00
Viv
c33cd4c7e7 .gitignore: Add .pytest_cache 2023-06-25 13:40:56 -04:00