-
Notifications
You must be signed in to change notification settings - Fork 14
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
Added status bar #40
Added status bar #40
Conversation
Added status bar and code tips
Split the status bar to multiple parts so more useful info can be displayed in the other parts.
- Removed the multiple sections in the status bar until they're useful for something. - Tweaked some tracker help messages.
Added a menu item to toggle the status bar's visibility
Added format attribute to format_status function
- Made the sign casting explicit since some printf implementations don't support %hhd. - Wrapped variable declaration within braces for switch case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM
src/inst.c
Outdated
int sel = SendMessage((HWND)lParam, LB_GETCURSEL, 0, 0); | ||
struct channel_state *c = &state.chan[0]; | ||
set_inst(&state, c, valid_insts[sel]); | ||
format_status(0, "ADSR: %02d/15 %d/7 %d/7 %02d/31", 0xF - (c->inst_adsr1 & 0xF), (c->inst_adsr1 >> 4) & 0x7, (c->inst_adsr2 >> 5) & 7, c->inst_adsr2 & 0x1F); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most resources for SNES envelopes out there leave attack as "higher = ramps up faster," so it might be better to drop the 0xF - attack part and display it raw. Your choice, though.
This doesn't handle GAIN either (when (c->inst_adsr1 & 0x80) == 0
) but that's not relevant to EarthBound.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compared to actual ADSR this is weird, but ok
src/status.c
Outdated
format_status(p, "Percussion %d", code[0] - 0xC9); | ||
} else { | ||
switch (code[0]) { | ||
case 0xE0: format_status(p, "Instrument %d", code[1]); break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To-do: special case for code[1] >= 0xCA, since that changes to a percussion instrument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added special note for values >= 0xCA
src/status.c
Outdated
} else { | ||
switch (code[0]) { | ||
case 0xE0: format_status(p, "Instrument %d", code[1]); break; | ||
case 0xE1: format_status(p, "Pan %d", code[1]); break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To-do: the two most-significant bits in code[1] are bit flags to invert the left/right channels. Only in [E1 XX] though, not the other pan code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added additional note for phase inversions
src/status.c
Outdated
case 0xE9: format_status(p, "Global transpose %d", (signed char)code[1]); break; | ||
case 0xEA: format_status(p, "Channel transpose %d", (signed char)code[1]); break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personal preference: %d
--> %+d
, so that it shows as +1 for positive numbers. I can confirm this works correctly with msvcrt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/status.c
Outdated
case 0xF1: format_status(p, "Enable portamento (delay: %d, duration: %d, range: +%d)", code[1], code[2], code[3]); break; | ||
case 0xF2: format_status(p, "Enable portamento (delay: %d, duration: %d, range: -%d)", code[1], code[2], code[3]); break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description doesn't seem accurate. The difference between F1 and F2 is that F1 starts at the target note and bends up/down range
semitones (cast it to signed char
!), while F2 starts displaced and bends back up/down to the actual named note.
What would be a good way to describe that... on SNESLab, they're called "Note Pitch Envelope To" and "Note Pitch Envelope From". Maybe something like "Enable portamento away from note" and "Enable portamento back to note"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified this slightly
src/status.c
Outdated
case 0xF5: | ||
format_status(p, "Enable echo (channels: %c%c%c%c%c%c%c%c, left volume: %d/255, right volume: %d/255)", | ||
'0' + (code[1] & 1), | ||
'0' + ((code[1] >> 1) & 1), | ||
'0' + ((code[1] >> 2) & 1), | ||
'0' + ((code[1] >> 3) & 1), | ||
'0' + ((code[1] >> 4) & 1), | ||
'0' + ((code[1] >> 5) & 1), | ||
'0' + ((code[1] >> 6) & 1), | ||
'0' + ((code[1] >> 7) & 1), | ||
code[2], | ||
code[3]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe left volume and right volume are more signed char
s. These numbers are written directly to DSP registers and they're out of 128. (Docs: fullsnes, S-DSP REGISTERS section of anomie's DSP documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this to signed values without specifying phase inversions. Hopefully that should be intuitive
src/status.c
Outdated
code[3]); | ||
break; | ||
case 0xF6: format_status(p, "Disable echo"); break; | ||
case 0xF7: format_status(p, "Echo settings (delay: %d, feedback: %d, filter: %d)", code[1], code[2], code[3]); break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feedback is like a reverb strength setting. So basically another signed char
volume out of 128
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/status.c
Outdated
break; | ||
} | ||
case 0xFA: format_status(p, "Base percussion instrument %d", code[1]); break; | ||
case 0xFB: format_status(p, "Unknown [FB %02X %02X]", code[1], code[2]); break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command doesn't do anything. It calls the function to consume an extra byte and then immediately returns: relevant disassembly section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relabeled to No op
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It builds on my end. I haven't thoroughly tested it or anything but it all looks good.
Added a status bar to the app that displays helpful notes about the currently selected command in the tracker tab and ADSR info for the currently selected instrument in the instruments tab.