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

Crash on attempt to import non-GM instrument on a case of bank absence #45

Closed
Wohlstand opened this issue Oct 29, 2018 · 5 comments
Closed
Assignees
Labels

Comments

@Wohlstand
Copy link
Owner

Wohlstand commented Oct 29, 2018

When you have count of bank less than importing instrument, the crash will happen as the reason of instruments store arrays mismatch. To fix this, it's need to check the instrument number, and then automatically expand the banks set to let instruments be correctly imported.

P.S. It's absolutely same crash on OPL3 Bank Editor as the same importer code was used in both cases.

@jpcima
Copy link
Collaborator

jpcima commented Oct 29, 2018

I think I understand about the mismatching banks.
What's the deal about the instrument vector and the pointer as distinct members? can't an instance of bank keep only the vector?

@Wohlstand
Copy link
Owner Author

Wohlstand commented Oct 29, 2018

What's the deal about the instrument vector and the pointer as distinct members? can't an instance of bank keep only the vector?

It's easy:

Every time you are resizing the Ins_Melodic_box vector, you must re-assign the Ins_Melodic with Ins_Melodic_box.data(); to renew the pointer that was became dead. Same with the case of drums.

However, I think, I'll equip the "FmBank" with generic functions to resize instruments storage without of direct deal with vector and pointer.

@jpcima
Copy link
Collaborator

jpcima commented Oct 30, 2018

This was not sufficient. When you import by "assign" mode, you have to match the banks of destination and source.
I think it means to create a bank if it does not exists in the destination, and dstination instrument can have a different index in the store.

@Wohlstand
Copy link
Owner Author

and dstination instrument can have a different index in the store.

Therefore don't do 1:1 assignment, but use MSB/LSB pair to identify the target bank (but, prevent ability to set duplicated bank key, the pair of MSB/LSB must be unique).

@jpcima jpcima mentioned this issue Nov 7, 2018
@Wohlstand
Copy link
Owner Author

I think, it's fine now. The fix that was taken long time ago, is fine 😉

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

No branches or pull requests

2 participants