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

Instrument player optimizations #52

Merged

Conversation

Kiroto
Copy link
Contributor

@Kiroto Kiroto commented Oct 1, 2023

Instruments now an interface, more flexibility when creating instruments.

Allows for pitch, sound and volume variations per note played

New Song class (iterable) used for reading song strings and playing them (no tempo feature... yet).

New song playing algorithm (used by song containers, AKA signs) which doesn't iterate through the string twice per note. Said algorithm is the one the Song class uses to read the song strings, iterating once to encode, and a second time to play.

An Iterator could be made that iterates directly on the string as if it was the song, and it would reduce the amount of loops to just once per song.

Reduced else/if wall on the GUI music sheet to a search in an array, and now uses the note system.

An optimization could be made when determining the pitch of the notes, currently using Math.pow(2, <integer>) when playing each note which could be precompiled, memoized or otherwise optimized.

Also, should we consider this thing I made as a substitute for the old harp sprite?
image

@Kiroto Kiroto marked this pull request as ready for review October 1, 2023 03:33
@TechPizzaDev TechPizzaDev merged commit fe32862 into Adventurecraft-Awakening:main Oct 2, 2023
2 checks passed
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.

2 participants