-
Notifications
You must be signed in to change notification settings - Fork 2
added support for y12 and tfi export #8
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 support for y12 and tfi export #8
Conversation
y12_file.c
Outdated
| if(bank->num_opn_voices <= pos->opn) return -1; | ||
| struct y12_file f; | ||
|
|
||
| strcpy(f.name, bank->opn_voices[pos->opn].name); |
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.
pretty sure strcpy is unsafe, I think you need to use strncpy or snprintf
tfi_file.c
Outdated
| f.alg = bank->opn_voices[pos->opn].fb_con & 0x07; | ||
| for(int i = 0; i < 4; i++) { | ||
| f.operators[i].dt = bank->opn_voices[pos->opn].operators[i].dt_mul >> 3; | ||
| f.operators[i].mul = bank->opn_voices[pos->opn].operators[i].dt_mul & 0x07; |
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.
please use the opn_voice_get_* functions everywhere (the opn_voice struct might change but these methods will still work the same way)
| .max_opm_voices = 1, | ||
| .max_opn_voices = 0, | ||
| .max_opm_voices = 0, | ||
| .max_opn_voices = 1, |
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.
👍
y12_file.c
Outdated
| f.fb = bank->opn_voices[pos->opn].fb_con >> 3; | ||
| f.alg = bank->opn_voices[pos->opn].fb_con & 0x07; | ||
| for(int i = 0; i < 4; i++) { | ||
| f.operators[i].mul_dt = bank->opn_voices[pos->opn].operators[i].dt_mul; |
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.
same, please use the get_* methods
|
Ok, makes sense. |
|
Wouldn't it make sense to have matching setter functions for loading as well? |
tfi_file.c
Outdated
| buf[bc++] = f->fb; | ||
| for(int i = 0; i < 4; i++) { | ||
| buf[bc++] = f->operators[i].mul; | ||
| buf[bc++] = f->operators[i].dt; |
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.
Just one last thing, create a uint8_t * pointer and increment that instead of incrementing the index, *(b++) = ...
|
Done |
y12_file.c
Outdated
| for(int i = 0; i < 4; i++) { | ||
| buf[bc++] = f->operators[i].mul_dt; | ||
| buf[bc++] = f->operators[i].tl; | ||
| buf[bc++] = f->operators[i].ar_rs; |
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.
same in this function
Also y12 struct had max_opm_voices = 1 and max_opn_voices = 0, it should probably be the other way round as y12 is an instrument format for YM2612/OPN2, right?