rem: if ((IAHIsub = (struct AHIsubIFace *) GetInterface((struct Library *) AHIsubBase, "main", 1, NULL)) == NULL)
add: if ((audioctrl->ahiac_IAHIsub = (struct AHIsubIFace *) GetInterface((struct Library *) AHIsubBase, "main", 1, NULL)) == NULL)
context: _AHI_AllocAudioA( struct TagItem* tags,		  struct AHIBase* AHIBase ){  struct AHIPrivAudioCtrl* audioctrl;  struct Library *AHIsubBase;  struct AHI_AudioDatabase *audiodb;  struct TagItem *dbtags;  if(AHIBase->ahib_DebugLevel >= AHI_DEBUG_LOW)  {    Debug_AllocAudioA(tags);  }  audioctrl = CreateAudioCtrl( tags );  if(!audioctrl)    goto error;  AHIBase->ahib_AudioCtrl=audioctrl;                      // Save latest (for KillAudio)  if(!audioctrl->ac.ahiac_Channels || !audioctrl->ac.ahiac_Sounds)    goto error;  audioctrl->ahiac_SubAllocRC = AHISF_ERROR;  audioctrl->ahiac_SubLib=  AHIsubBase = OpenLibrary(audioctrl->ahiac_DriverName,DriverVersion);//KPrintF("Opened AHIsubBase()\n");  if(!AHIsubBase)    goto error;#ifdef __AMIGAOS4__  if ((IAHIsub = (struct AHIsubIFace *) GetInterface((struct Library *) AHIsubBase, "main", 1, NULL)) == NULL)  {           goto error;  }#endif  // Never allow drivers that are newer than ahi.device.  if(AHIsubBase->lib_Version > Version)    goto error;  audiodb=LockDatabase();  if(!audiodb)    goto error;  dbtags=GetDBTagList(audiodb,audioctrl->ahiac_AudioID);  if(dbtags)    audioctrl->ahiac_SubAllocRC=AHIsub_AllocAudio(dbtags,(struct AHIAudioCtrlDrv *)audioctrl);//KPrintF("Called AHIsub_AllocAudio()\n");  UnlockDatabase(audiodb);  if(!dbtags)    goto error;  UpdateAudioCtrl(audioctrl);  if(audioctrl->ahiac_SubAllocRC & AHISF_ERROR)    goto error;// Mixing  if(!(audioctrl->ahiac_SubAllocRC & AHISF_MIXING))    audioctrl->ac.ahiac_Flags |= AHIACF_NOMIXING;// Timing      if(!(audioctrl->ahiac_SubAllocRC & AHISF_TIMING))    audioctrl->ac.ahiac_Flags |= AHIACF_NOTIMING;// Stereo  if(!(audioctrl->ahiac_SubAllocRC & AHISF_KNOWSTEREO))    audioctrl->ac.ahiac_Flags &= ~AHIACF_STEREO;// Multichannel 7.1  if(!(audioctrl->ahiac_SubAllocRC & AHISF_KNOWMULTICHANNEL))    audioctrl->ac.ahiac_Flags &= ~AHIACF_MULTICHANNEL;  // HiFi  if(!(audioctrl->ahiac_SubAllocRC & AHISF_KNOWHIFI))    audioctrl->ac.ahiac_Flags &= ~AHIACF_HIFI;// Post-processing  if(audioctrl->ahiac_SubAllocRC & AHISF_CANPOSTPROCESS)    audioctrl->ac.ahiac_Flags |= AHIACF_POSTPROC;  if(!(audioctrl->ac.ahiac_Flags & AHIACF_NOMIXING))  {    switch(audioctrl->ac.ahiac_Flags & (AHIACF_STEREO | AHIACF_HIFI | AHIACF_MULTICHANNEL))    {      case 0:        audioctrl->ac.ahiac_BuffType=AHIST_M16S;        break;      case AHIACF_STEREO:        audioctrl->ac.ahiac_BuffType=AHIST_S16S;        break;      case AHIACF_HIFI:        audioctrl->ac.ahiac_Flags |= AHIACF_CLIPPING;        audioctrl->ac.ahiac_BuffType=AHIST_M32S;        break;      case (AHIACF_STEREO | AHIACF_HIFI):        audioctrl->ac.ahiac_Flags |= AHIACF_CLIPPING;        audioctrl->ac.ahiac_BuffType=AHIST_S32S;        break;      case (AHIACF_STEREO | AHIACF_HIFI | AHIACF_MULTICHANNEL):        audioctrl->ac.ahiac_Flags |= AHIACF_CLIPPING;        audioctrl->ac.ahiac_BuffType=AHIST_L7_1;        break;      default:        Alert(AT_Recovery|AG_BadParm);        goto error;    }/* Max channels/2 channels per hardware channel if stereo w/o pan */    if((audioctrl->ac.ahiac_Flags & (AHIACF_STEREO | AHIACF_PAN)) == AHIACF_STEREO)      audioctrl->ahiac_Channels2=(audioctrl->ac.ahiac_Channels+1)/2;    else      audioctrl->ahiac_Channels2=audioctrl->ac.ahiac_Channels;    if(!(audioctrl->ac.ahiac_Flags & AHIACF_NOTIMING))    {      RecalcBuff(audioctrl->ac.ahiac_MinPlayerFreq,audioctrl);      audioctrl->ac.ahiac_BuffSize=audioctrl->ahiac_BuffSizeNow;      RecalcBuff(audioctrl->ac.ahiac_PlayerFreq,audioctrl);    }    else // No timing    {      ULONG size;      size=audioctrl->ac.ahiac_BuffSamples*\           AHI_SampleFrameSize(audioctrl->ac.ahiac_BuffType)*\           (audioctrl->ac.ahiac_Flags & AHIACF_POSTPROC ? 2 : 1);      size +=7;      size &= ~7;  // byte align      audioctrl->ahiac_BuffSizeNow=size;    }    audioctrl->ac.ahiac_MixerFunc=AllocVec(sizeof(struct Hook),MEMF_PUBLIC|MEMF_CLEAR);    if(!audioctrl->ac.ahiac_MixerFunc)      goto error;    audioctrl->ac.ahiac_MixerFunc->h_Entry    = (HOOKFUNC) HookEntryPreserveAllRegs;    audioctrl->ac.ahiac_MixerFunc->h_SubEntry = (HOOKFUNC) MixerFunc;    if((AHIBase->ahib_MaxCPU >= 0x10000) || (AHIBase->ahib_MaxCPU <= 0x0))    {      audioctrl->ahiac_MaxCPU = 0x100;    }    else    {      audioctrl->ahiac_MaxCPU = AHIBase->ahib_MaxCPU >> 8;    }    audioctrl->ac.ahiac_PreTimer  = (BOOL (*)(void)) PreTimerPreserveAllRegs;    audioctrl->ac.ahiac_PostTimer = (void (*)(void)) PostTimerPreserveAllRegs;    audioctrl->ac.ahiac_PreTimerFunc=AllocVec(sizeof(struct Hook),MEMF_PUBLIC|MEMF_CLEAR);    if(!audioctrl->ac.ahiac_PreTimerFunc)      goto error;    audioctrl->ac.ahiac_PostTimerFunc=AllocVec(sizeof(struct Hook),MEMF_PUBLIC|MEMF_CLEAR);    if(!audioctrl->ac.ahiac_PostTimerFunc)      goto error;    audioctrl->ac.ahiac_PreTimerFunc->h_Entry    = (HOOKFUNC) HookEntry;    audioctrl->ac.ahiac_PreTimerFunc->h_SubEntry = (HOOKFUNC) PreTimerFunc;        audioctrl->ac.ahiac_PostTimerFunc->h_Entry    = (HOOKFUNC) HookEntry;    audioctrl->ac.ahiac_PostTimerFunc->h_SubEntry = (HOOKFUNC) PostTimerFunc;        if( !InitMixroutine( audioctrl ) ) goto error;  }  audioctrl->ac.ahiac_SamplerFunc = AllocVec(sizeof(struct Hook),      MEMF_PUBLIC|MEMF_CLEAR);  if(!audioctrl->ac.ahiac_SamplerFunc)    goto error;  audioctrl->ac.ahiac_SamplerFunc->h_Entry    = (HOOKFUNC) HookEntry;  audioctrl->ac.ahiac_SamplerFunc->h_SubEntry = (HOOKFUNC) SamplerFunc;  /* Set default hardware properties, only if AHI_DEFAULT_ID was used!*/  if(GetTagData(AHIA_AudioID, AHI_DEFAULT_ID, tags) == AHI_DEFAULT_ID)  {    AHI_ControlAudio((struct AHIAudioCtrl *)audioctrl,        AHIC_MonitorVolume,   AHIBase->ahib_MonitorVolume,        AHIC_InputGain,       AHIBase->ahib_InputGain,        AHIC_OutputVolume,    AHIBase->ahib_OutputVolume,        AHIC_Input,           AHIBase->ahib_Input,        AHIC_Output,          AHIBase->ahib_Output,        TAG_DONE);  }exit:  if(AHIBase->ahib_DebugLevel >= AHI_DEBUG_LOW)  {    KPrintF("=>0x%08lx\n", (ULONG) audioctrl);  }  return (struct AHIAudioCtrl *) audioctrl;error:  AHI_FreeAudio((struct AHIAudioCtrl *)audioctrl);  audioctrl=NULL;  goto exit;}