IPlugAAX's mTransport
There seems to be a design flaw in IPlugAAX…
IPlugAAX has a private member mTransport that duplicates the functionality of private member mTransport in AAX_CIPlugParameters, which IPlugAAX inherits. The latter initializes its mTransport upon class initialization; IPlugAAX sets its mTransport (repeatedly) in IPlugAAX::RenderAudio. GetTempo and other functions require IPlugAAX’s mTransport, and assume it’s a valid pointer (crash if null). So, the audio thread needs to be running before GetTempo and others are safe (potential race condition).
Before telling me ways to work around it, yeah, I know how (now that I’ve spent time debugging to get to this point, of course). My point is that all of this is needless. AAX_CIPlugParameters already has the transport, as soon as the IPlug is alive. It has an accessor, Transport(). So, mTransport should be removed from IPlugAAX, and all functions that require it should replace mTransport with Transport(). No race condition, no needless refetching of the transport in the audio thread (I’m pretty sure the transport can’t change after a plugin is instantiated), less confusing code.
Comments? Anything I’m missed?
|