Quote:
Originally Posted by sstillwell
How did you wind up doing that to make it compatible across 32/64 bit? Macro changes like Apple does, or did you just #ifdef the whole section of code and reverse the index numbers?
|
I used a variation on Apple's macro:
Code:
#if __LP64__
#define GET_COMP_PARAM(TYPE, IDX, NUM) *((TYPE*)&(params->params[NUM - IDX]))
#else
#define GET_COMP_PARAM(TYPE, IDX, NUM) *((TYPE*)&(params->params[IDX]))
#endif
And then:
Code:
case kAudioUnitGetPropertyInfoSelect: {
AudioUnitPropertyID propID = GET_COMP_PARAM(AudioUnitPropertyID, 4, 5);
AudioUnitScope scope = GET_COMP_PARAM(AudioUnitScope, 3, 5);
AudioUnitElement element = GET_COMP_PARAM(AudioUnitElement, 2, 5);
UInt32* pDataSize = GET_COMP_PARAM(UInt32*, 1, 5);
Boolean* pWriteable = GET_COMP_PARAM(Boolean*, 0, 5);
Etc. etc.