CGA as a mathematical function
Let P be the packet's channel memberships and S be the listener's subscribed channels. CGA only looks at the overlap.
M = P ∩ S
CGA(M, g, p, G) = 0, if |M| = 0
CGA(M, g, p, G) = clamp(A(M) × B(M), 0, G)
A(M) = ( 1/|M| · Σc∈M min(gc, 1)p )1/p
B(M) = max(1, maxc∈M gc)
gc is a channel's linear gain: 0.0 mute, 1.0 unity, 1.5 max boost.p = 2 gives RMS / equal-power attenuation. Higher values move toward max-like behavior.G = 1.5, so final output cannot exceed 150% linear gain.- Find matching channels: packet membership AND listener subscription.
- Combine cuts with a power mean so one muted overlap does not erase every other path.
- Combine boosts with
max()so boosts do not stack louder and louder. - Apply the resulting single gain to the one received packet.
CGA is not deduplication. It assumes there is already only one packet/audio object. The job is to resolve multiple logical channel controls into one gain decision.