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

Fix monitoring for objects sharing input audio #258

Closed firthm01 closed 9 months ago

firthm01 commented 11 months ago

Original issue; The SceneGainsCalculator class just kept a single pair of gains tables (vector of vectors, one for diffuse and one for direct feeds) for all items (i.e, AudioObjects).
The SceneGainsCalculator::update method would iterate through all items in the store and run the addOrUpdateItem method to set the gains for the item in the gains tables (direct_ and diffuse_ members). Likewise the removeItem method would zero affected entries in the tables. Due to this "overwrite" behaviour, it meant that input sharing between objects was not possible. The last item to be processed in the store would overwrite gains set by any previous item which is also using those input channels.

Solution: Each item keeps it's own pair of gains tables in the existing ItemRouting struct. These tables are only big enough for the item channel count for efficiency, rather than being sized to fit the total input and output channel count. When the backend requests the gain matrices, these are built at the point of request by summing all of the gain tables for all of the items in to an Eigen::MatrixXf which is initialised to zero, using the addToEigenMat free func. Note that the input channels when summing in to the matrix are offset by the starting channel number of the item. This isolation of gains tables means we don't need to concern ourselves with what other items might be affected when the routing of one item changes, because their tables are calculated independently. This means we can get rid of the flagOverlaps which would previously set all items to "changed" to ensure the entire gains table was rebuilt.

Note that the first commit of this PR corrects some terminology (var names) in existing code before work commenced as it led to some confusion when implementing the new system.

Closes #257

firthm01 commented 11 months ago

Force push was rebase on main (128 ch support)

firthm01 commented 9 months ago

Force push was rebase on main (CI fix)