anchor.diff:    if FreeBuf = -1 then Exit;//Don't play if there's no room left
   
     //Fade music if required (don't fade it if the user has SoundGain = 0, that's confusing)
  -  if FadeMusic and (fSoundGain > 0) and not fMusicIsFaded then
  +  if aFadeMusic and (fSoundGain > 0) and not fMusicIsFaded then
     begin
       if Assigned(fOnFadeMusic) then fOnFadeMusic;
       fMusicIsFaded := true;
  
positive.code: begin
    Result := -1;
    if not fIsSoundInitialized then Exit;
    if (SoundID = sfxNone) and (aFile = '') then Exit;
  
    //Do not play game sounds, if game is ready to stop
    if (aSoundType = stGame) and (gGame <> nil) and (gGame.ReadyToStop) then
      Exit;
  
  
    if Attenuated then
    begin
      Distance := GetLength(Loc.X-fListener.Pos[1], Loc.Y-fListener.Pos[2]);
      //If sound source is further than Radius away then don't play it. This stops the buffer being filled with sounds on the other side of the map.
      if (Distance >= Radius) then Exit;
      //If the sounds is a fairly long way away it should not play when we are short of slots
      if (Distance >= Radius*MAX_PRIORITY_DISTANCE_FACTOR) and (ActiveCount >= MAX_FAR_SOUNDS) then Exit;
      //Attenuated sounds are always lower priority, so save a few slots for non-attenuated so that troops
      //and menus always make sounds
      if (ActiveCount >= MAX_ATTENUATED_SOUNDS) then Exit;
  
negative.code:     procedure AbortAllLongSounds;
  
      procedure UpdateListener(X,Y: Single);
      procedure UpdateSoundVolume(aValue: Single);
  
      function IsScriptSoundPlaying(aScriptIndex: Integer): Boolean;
  
  