rem: switch( prefs->ahiup_ScaleMode )
add: switch( globalprefs.ahigp_ScaleMode )
context: BOOL PlaySound( struct AHIUnitPrefs* prefs ){  struct AHIAudioCtrl* actrl;  BOOL                 rc = FALSE;    actrl = AHI_AllocAudio( AHIA_AudioID,  prefs->ahiup_AudioMode,                          AHIA_MixFreq,  prefs->ahiup_Frequency,                          AHIA_Channels, 1,                          AHIA_Sounds,   1,                          TAG_DONE );  if( actrl != NULL )  {    WORD*                sample;    int                  length = 48000/440;    struct AHISampleInfo sound;          sample = AllocVec( length * sizeof( *sample ), MEMF_PUBLIC );          if( sample != NULL )    {      int i;              for( i = 0; i < length; ++i )      {        sample[ i ] = 0x7fff * sin( i * 2 * M_PI / length );      }              sound.ahisi_Type    = AHIST_M16S;      sound.ahisi_Address = sample;      sound.ahisi_Length  = length;              if( AHI_LoadSound( 0, AHIST_SAMPLE, &sound, actrl ) == AHIE_OK )      {        if( AHI_ControlAudio( actrl, AHIC_Play,          FALSE,                                     AHIC_MonitorVolume, prefs->ahiup_MonitorVolume,                                     AHIC_InputGain,     prefs->ahiup_InputGain,                                     AHIC_OutputVolume,  prefs->ahiup_OutputVolume,                                     AHIC_Input,         prefs->ahiup_Input,                                     AHIC_Output,        prefs->ahiup_Output,                                     TAG_DONE ) == AHIE_OK )        {	  ULONG volume = 0x10000;	  	  switch( prefs->ahiup_ScaleMode )	  {	    case AHI_SCALE_DYNAMIC_SAFE:	      volume = 0x10000;	      break;	    case AHI_SCALE_FIXED_SAFE:	      if( prefs->ahiup_Channels != 0 )	      {		volume = 0x10000 / prefs->ahiup_Channels;	      }	      break;	    case AHI_SCALE_FIXED_0_DB:	      volume = 0x10000;	      break;		    case AHI_SCALE_FIXED_3_DB:	      volume = 0xB505;	      break;	    case AHI_SCALE_FIXED_6_DB:	      volume = 0x8000;	      break;	  }	            AHI_Play( actrl, AHIP_BeginChannel, 0,                           AHIP_Freq,         48000,                           AHIP_Vol,          volume,                           AHIP_Pan,          0x8000,                           AHIP_Sound,        0,                           AHIP_EndChannel,   0,                           TAG_DONE );	  if( AHI_ControlAudio( actrl, AHIC_Play, TRUE, TAG_DONE ) == AHIE_OK )	  {	    if( prefs->ahiup_ScaleMode == AHI_SCALE_DYNAMIC_SAFE )	    {	      Delay( 10 );	      AHI_SetVol( 0, volume / 2, 0x8000, actrl, AHISF_IMM );	      Delay( 30 );	      AHI_SetVol( 0, volume, 0x8000, actrl, AHISF_IMM );	      Delay( 10 );	    }	    else	    {	      Delay( 50 );	    }          	    AHI_Play( actrl, AHIP_BeginChannel, 0,                             AHIP_Sound,        AHI_NOSOUND,                             AHIP_EndChannel,   0,                             TAG_DONE );	    // Give the anti-click code a chance to do it's work ...	    Delay( 1 );	    AHI_ControlAudio( actrl, AHIC_Play, FALSE,                                     TAG_DONE );	  }        }        AHI_UnloadSound( 0, actrl );      }              FreeVec( sample );    }        AHI_FreeAudio( actrl );  }  return rc;}