Thread: WDL in the wild
View Single Post
Old 11-04-2010, 02:07 PM   #84
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: Holland
Posts: 2,906
Default

Quote:
Originally Posted by sstillwell View Post
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.
Tale is offline   Reply With Quote