vgmtrans
vgmtrans copied to clipboard
Collections tab empty - Prevents exporting VAB to SF2
Describe the bug You can't export the Instrument Sets because VGMSampColls are never associated with the VAB. There doesn't seem to be any way to associate them.
To Reproduce
- Load FATHEAD.SND from the attached zip into VGMTrans.
- Notice there are 2 VAB and a VGMSampColl that successfully parse into the Detected Music Files tab.
- Notice that the "Collections" Tab is empty.
- Set a breakpoint in VGMInstrSet.cpp line 129:
bool VGMInstrSet::SaveAsSF2(const std::wstring &filepath) {
SF2File *sf2file = NULL;
if (assocColls.size())
sf2file = assocColls.front()->CreateSF2File();
else
return false; // BREAKPOINT HERE
- Right click one of the VABs and try to export it as a .SF2 file
- Notice that the breakpoint gets hit.
- Check assocColls.size(), and notice that it's empty. The exporter never gets farther than this step.
Expected behavior There needs to be a way to associate Colls in order to successfully export .sf2 files.
You can hack in a fix for this by changing line 274 of Matcher.cpp
if (instrsets.size() == 1 && sampcolls.size() == 1) {
Change it to
if (instrsets.size() >= 1 && sampcolls.size() == 1) {
This results in assigning the front() instrument set. In the example file above, there are 2 instrument sets, and therefore you can't get any result at all. This hack at least allows exporting and playing the files.
I'm not sure what the correct fix is, however. Presumably the information necessary to create a match exists and is being ignored.
There doesn't seem to be any way to associate them.
With recent builds there's an option to create collections manually, it should help in situations like this. Then again, if the instrument set has no sample collection linked, it's plausible that the program couldn't find any and the sample collection you're seeing is a false positive.
The sample collection is legit. The audio file produced by using the above hack results in a near perfect match to the audio available on youtube (the reverb and volume might not be perfect, but I'm assuming that's limitations of the midi format).
Do you get different results from "Create collection manually"? (the feature is only present in Qt builds)
Do you get different results from "Create collection manually"? (the feature is only present in Qt builds)
I'm currently building the WTL build, I think. I don't have any option to create manually (Though I imagine, if you were to manually connect the same objects, that you'd get a working result?).
The issue is, from what I can tell, that the Matcher class only will connect objects if there is exactly 1 of each object. However, for export purposes, the only thing that actually matters is that there is only one SampleColl (it doesn't matter how many VABs there are when exporting because the singular VAB is implicit in the export command).
I'm currently building the WTL build, I think.
We don't plan adding new features to WTL. It will be dropped after the next stable release, actually. Try with the latest qt build here.
As far as Matcher goes, there's many different versions implementing different heuristics according to the format, I'm not sure what's going on in this particular instance as I'm not familiar with the PS part of the codebase
(also note that Qt uses SF2 and not DLS for playback, this might result in playback being a bit different)
Ok I just checked: Manually creating a user-defined collection using the QT version does allow export.
Basically a VAB that doesn't belong to any collection can't be exported.
I added a log because it's too bad when an operation fails without a reason being given. I think the response should be more user-noticeable, but it's better than nothing.
I think the experience would be better if we could export DLS/SF2 without having to manually create the collection, but that may be difficult without changing the current sequence-first design.
When we have VGMInstrSet and VGMSampColl selected and the right-click menu open, it would probably be useful to be able to export DLS/SF2 without having to manually create a collection, or to create a collection with a single click.
When we have VGMInstrSet and VGMSampColl selected and the right-click menu open, it would probably be useful to be able to export DLS/SF2 without having to manually create a collection, or to create a collection with a single click.
It will take a big of ugly dynamic casting but it's definitely doable