-
Notifications
You must be signed in to change notification settings - Fork 80
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
Clarify the relation between hMusicTrack, hNextMusicTrack and wActiveMusicTrack #232
Comments
wActiveMusicTrack ($D368) - setting this begins playing a new track and then resets itself to 00 hMusicTrack ($FFB0) - is the track of the current area, e.g. overworld, village, mysterious forest, etc. hNextMusicTrack ($FFB1) - is set when entering a new area and the previous track begins fading out. When the music from the previous area has finished fading out, hNextMusicTrack is set to 00. hNextWorldMusicTrack ($FFBF) - Same as_ hMusicTrack_, but set immediately when entering a new area, rather than when the previous track has fully faded out. |
When $D369 is set to 00, music stops playing. For music that plays after a previous track has faded out first: For music that plays immediately without fading out the previous track first: |
When manually setting the music using wActiveMusicTrack using a debugger, $D369 holds the ID of the currently audible track, but but with a value subtracted. (See next comment) |
wMusicMode ($D3CE) - For some tracks this is set to 01. For others, it is set to 00. When writing $00 to $10 to wActiveMusicTrack, $D369 matches the trackID written to wActiveMusicTrack. wMusicMode set to 01 EDIT: Whether wMusicMode is set to 01 or not seems to depend on whether MusicDataPointerTable_1E (music_2.asm) is used or not, rather than MusicDataPointerTable_1B (music_1.asm) |
I propose wActiveMusicTrack be renamed to wMusicTrackToPlay, hNextMusicTrack to hNextScreenTrackToFadeInto, but I am not sure about this one. I will have to do some more debugging on this. hNextWorldMusicTrack to hNextScreenTrack - for consistency with hCurrentScreenTrack, but 'World' instead of 'Area' is fine. |
Nice findings 👍 So, apparently, music tracks all have a global ID, which is a unique number identifying a track (that would match the MUSIC_ constants in But tracks can be stored in two different pointers tables (in music_1 and music_2). So tracks IDs have an associated So we can make clear in the naming or the variables whether we are speaking about the index of a music track (i.e. the substracted value that is used to look up addresses in the pointers table) or the id of a music track (i.e. the value equal to the So I would suggest:
What do you think? |
I'm glad you figured all that index stuff out!
|
I will change these variables and submit a PR tomorrow. EDIT: done. |
There are several variables controlling the music track playback:
hMusicTrack
,hNextMusicTrack
,wActiveMusicTrack
These variables are often used together, but seem to have subtle differences (like one of these seems to have immediate effect, and another to store the track to be played after a transition).
We should understand better what these variables do (and maybe rename some of them accordingly).
The text was updated successfully, but these errors were encountered: