Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting decoupled tracks from main BGM bank #1

Merged
merged 2 commits into from Sep 20, 2023

Conversation

irdkwia
Copy link
Contributor

@irdkwia irdkwia commented Sep 19, 2023

Adds an optional parameter to choose if samples must be included in the individual tracks SWD or to the main bank
The sound engine actually supports using a pre-defined pcmd chunk inside of the individual tracks to store track samples instead of creating one in memory using bits of the main bank

Main advantage of decoupled tracks
Portability: allows individual generated SMD/SWD tracks not to be linked to any external SWD bank, which means they can be copied to any ROM without needing to change the main bank (this could also work with other games using the same engine that do not have a main BGM bank, but not verified)

Main drawback of decoupled tracks
Memory usage: takes a bit more space than storing to the main bank, as samples reused between several tracks are not shared
Note: this only affect ROM memory usage, in game RAM memory usage is equivalent no matter what method is preferred

@adakite1
Copy link
Owner

Thanks for the PR Irdkwia! Everything looks good.
In relation to the inefficient sample info search, the most efficient way would be to directly add the samples during the track-specific swdl creation stage with copy_raw_sample_data, but that would require a major refactoring change of an entire chunk of the code (namely the part of the code that tags used samples, which with decoupled tracks needs to be tagged on a per-song basis).
The nested loop is concerning, but from testing I felt like the performance hit was within a comfortable range, so I'll merge this PR and leave that part as a todo.

@adakite1 adakite1 merged commit 72579b3 into adakite1:master Sep 20, 2023
@adakite1
Copy link
Owner

adakite1 commented Oct 8, 2023

I've reimplemented the decoupled track generation along with the refactoring and big move, and it now copies samples directly into the individual tracks' SWDs, so the inefficient search issue should now be solved. (7235d4a)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants