ebu / ear-production-suite

The EAR Production Suite is a set of VST® plugins and tools for producing immersive and personalizable audio content suitable for any Next Generation Audio codec. It is based on the Audio Definition Model (ITU-R BS.2076) and the ITU ADM Renderer (ITU-R BS.2127) and enables monitoring on any ITU-R BS.2051 loudspeaker configuration.
https://ear-production-suite.ebu.io/
GNU General Public License v3.0
102 stars 19 forks source link

Issue when rendering ADM from a project with JS plugins #279

Closed WernerBleisteiner closed 4 months ago

WernerBleisteiner commented 4 months ago

I have this strange error occuring trying to render an ADM. image The session itself works fine and everything sounds as it should do. Hitting "render" stars the process - but no file is written. Even deleting EPS plugins, re-inserting and re-routing all does not help. Any idea? Thanks. w

firthm01 commented 4 months ago

Hmm, that's a new one. Do you have an RPP file you could share? email is fine if that's easier.

firthm01 commented 4 months ago

OK, I've found the problem - it's because there's a JS effect in the chain and I'm not handling that correctly. The origin of the problem is how we deal with plugins that might have been renamed in the DAW. This makes it difficult for the code to look for EPS plugins in the project. There's a custom function to handle this and extract the plugins original name, but it only looks for VSTs. So when there's a JS effect (or probably any other type) in the chain, those get ignored, and so then VST position numbers get shifted up. As a consequence, it will then miss ones at the end of FX chains that have other plugin types in them.

Quick fix for now is to not have anything other than VSTs in a chain, or if you must, try place them after the EPS plugins.


Notes for self to fix;

The problem occurs in ReaperAPIImpl::TrackFX_GetActualFXName through the call stack (top to bottom);

EarVstExportSources::getEarInputPluginsWithInputInstanceId(unsigned int inputInstanceId, const admplug::ReaperAPI & api) Line 414
EarInputVst::isInputPlugin(const admplug::ReaperAPI & api, MediaTrack * trk, int vstPos) Line 470
admplug::ReaperAPIImpl::TrackFX_GetActualFXName(MediaTrack * track, int fx, std::string & name) Line 967

getEarInputPluginsWithInputInstanceId iterates through plugin positions up to the limit of api.TrackFX_GetCount(trk) It checks to see if this is an EPS plugin using isInputPlugin(api, trk, vstPos) isInputPlugin calls TrackFX_GetActualFXName(trk, vstPos, name) to ensure it gets the original name of the plugin

HOWEVER...

TrackFX_GetActualFXName parses the state chunk (from GetTrackStateChunkStr(track)) and extracts all "VST" elements with GetVSTElementsFromTrackStateChunk. GetVSTElementsFromTrackStateChunk doesn't consider the nested structure of the state chunk. It just looks for instances of "<VST " in the chunk sequentially, then looks for the ">" closing tag and pushes that range as a string in to a vector. The vector therefore only contains chunks of VST data and the index doesn't necessarily correspond to the VST position, since it's ignored any other type of FX that might have been before it.

AN EXAMPLE TRACK STATE CHUNK WITH A JS FX:

<TRACK
NAME 4+5+0-BED
PEAKCOL 18162691
BEAT -1
AUTOMODE 0
PANLAWFLAGS 3
VOLPAN 1 0 -1 -1 1
MUTESOLO 0 0 0
IPHASE 0
PLAYOFFS 0 1
ISBUS 0 0
BUSCOMP 0 0 0 0 0
SHOWINMIX 1 0.6667 0.5 1 0.5 0 0 0
REC 0 0 1 0 0 0 0 0
VU 2
TRACKHEIGHT 173 0 0 0 0 0 0
INQ 0 0 0 0.5 100 0 0 100
NCHAN 10
FX 1
TRACKID {D21D9ADB-FAD1-1D41-B2FF-5EAFF99071EA}
PERF 0
MIDIOUT -1
MAINSEND 0 0
<FXCHAIN
WNDRECT -200 1842 877 512
SHOW 0
LASTSEL 0
DOCKED 0
BYPASS 1 0 0
<JS Analysis/WigMCVUMeter ""
10 100 60 10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
JS_DIMS 646 456
FLOATPOS 822 1333 646 484
FXID {68EC005A-FEA5-AD45-B67F-8E49C2FC9A3F}
WAK 0 0
BYPASS 0 0 0
<VST "VST3: EAR DirectSpeakers (EBU)" "EAR DirectSpeakers.vst3" 0 "" 1950497277{ABCDEF019182FAEB4542552045505310} ""
/TlCdO5e7f4YAAAAAQAAAAAAAAACAAAAAAAAAAQAAAAAAAAACAAAAAAAAAAQAAAAAAAAACAAAAAAAAAAQAAAAAAAAACAAAAAAAAAAAABAAAAAAAAAAIAAAAAAAAABAAAAAAAAAAIAAAAAAAAABAAAAAAAAAAIAAAAAAAAABAAAAAAAAAAIAAAAAAAAAAAAEAAAAAAAAAAgAAAAAAAAAEAAAAAAAAAAgAAAAAAAAAEAAAAAAAAAAgAAAAAAAAAEAAAAAAAAAAgAAAAAAACgAAAAEA
AAAAAAAAAgAAAAAAAAAEAAAAAAAAAAgAAAAAAAAAEAAAAAAAAAAgAAAAAAAAAEAAAAAAAAAAgAAAAAAAAAAAAQAAAAAAAAACAAAAAAAAEAEAAAEAAAD//xAA
AAEAAAEAAABWQzIhuwAAADw/eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04Ij8+IDxEaXJlY3RTcGVha2Vyc1BsdWdpbiBjb25uZWN0aW9uX2lkPSJiYWJiOGJlNS1kZDY3LTRjN2EtOTMyMi0xNDBmZDhkNTU2NjIiIHJvdXRpbmc9IjIiIHBhY2tmb3JtYXRfaWRfdmFsdWU9IjUiIHVzZV90cmFja19uYW1lPSIxIiBuYW1lPSI0KzUrMC1CRUQiLz4AAAAAAAAA
AABKVUNFUHJpdmF0ZURhdGEAAQFCeXBhc3MAAQEDAB0AAAAAAAAASlVDRVByaXZhdGVEYXRhAAAAAAAAAAA=
AFByb2dyYW0gMQAQAAAA
>
FLOATPOS 0 0 0 0
FXID {619E247D-72F5-9148-BE94-FC0B33FDD89F}
WAK 0 0
>
<ITEM
POSITION 0
SNAPOFFS 0
LENGTH 36
LOOP 1
ALLTAKES 0
FADEIN 1 0 0 1 0 0 0
FADEOUT 1 0 0 1 0 0 0
MUTE 0 0
SEL 0
IGUID {0D94A70D-531C-094B-A18D-E44CF0734A56}
IID 97
NAME 03-4+5+0-BED-MC.wav
VOLPAN 1 0 1 -1
SOFFS 0
PLAYRATE 1 1 0 -1 0 0.0025
CHANMODE 0
GUID {01027D02-9ABC-5D4A-B65A-9B8577720BF1}
<SOURCE WAVE
FILE "C:\Users\matthewf\Documents\BLITS-514-REWORK-ADM-FIX_4-STEMS.RPP\BLITS-514-REWORK-ENHANCED-CONS/BLITS-514-REWORK-ENHANCED-CONS/exported-SINGLE TRACKS/03-4+5+0-BED-MC.wav"
>
>
>

TWO OPTIONS:

WernerBleisteiner commented 4 months ago

👍 Gosh. Brillant, Matt. Thanks. Will obey that. Needed Bruce's (JS) multitrack meter to better watch all levels at once before EPS. As all levels are now set, it can be deleted.