rem: cd->cd_NextVolumeLeft  = ((volume >> 1) * ((0x10000 - pan) >> 1)) >> (16 - 2);
add: cd->cd_NextVolumeLeft  = ((volume >> 1) * ((0x10000 - abs(pan)) >> 1)) >> (16 - 2);
context: SetVol ( REG(d0, UWORD channel),         REG(d1, Fixed volume),         REG(d2, sposition pan),         REG(a2, struct AHIPrivAudioCtrl *audioctrl),         REG(d3, ULONG flags),         REG(a6, struct AHIBase *AHIBase) ){  struct AHIChannelData *cd;  struct Library        *AHIsubBase;  ULONG                  rc;  if(AHIBase->ahib_DebugLevel >= AHI_DEBUG_ALL)  {    Debug_SetVol(channel, volume, pan, audioctrl, flags);  }  if(AHIBase->ahib_Flags & AHIBF_NOSURROUND)  {    volume = abs(volume);    pan    = abs(pan);  }  AHIsubBase = audioctrl->ahiac_SubLib;  rc = AHIsub_SetVol(channel, volume, pan, &audioctrl->ac, flags);  if(audioctrl->ac.ahiac_Flags & AHIACF_NOMIXING     || rc != AHIS_UNKNOWN)  {    return 0;   /* We're done! */  }  cd = &audioctrl->ahiac_ChannelDatas[channel];  if((audioctrl->ac.ahiac_Flags & AHIACF_VOL) == 0)  {    volume = volume & 0x10000;  /* |volume|=0 or 0x10000 */  }  if((audioctrl->ac.ahiac_Flags & AHIACF_PAN) == 0)  {    pan = (channel & 1) << 16;  /* pan = 0 or 0x10000 */  }  AHIsub_Disable(&audioctrl->ac);  cd->cd_NextVolumeLeft  = ((volume >> 1) * ((0x10000 - pan) >> 1)) >> (16 - 2);  cd->cd_NextVolumeRight = ((volume >> 1) * (pan >> 1)) >> (16 - 2);  if(flags & AHISF_IMM)  {    cd->cd_VolumeLeft  = cd->cd_NextVolumeLeft;    cd->cd_VolumeRight = cd->cd_NextVolumeRight;    SelectAddRoutine(cd->cd_VolumeLeft, cd->cd_VolumeRight, cd->cd_Type, audioctrl,                     &cd->cd_ScaleLeft, &cd->cd_ScaleRight, (ADDFUNC**) &cd->cd_AddRoutine);  }  SelectAddRoutine(cd->cd_NextVolumeLeft, cd->cd_NextVolumeRight, cd->cd_NextType, audioctrl,                   &cd->cd_NextScaleLeft, &cd->cd_NextScaleRight, (ADDFUNC**) &cd->cd_NextAddRoutine);  AHIsub_Enable(&audioctrl->ac);  return 0;}