anchor.diff:  procedure TKMSoundPlayer.UpdateSoundVolume(Value: Single);
     procedure UpdateSound(aI: Integer);
     begin
  -    AlSourcef(fSound[aI].ALSource, AL_GAIN, 1 * fSound[aI].Volume * fSoundGain);
  +    AlSourcef(fALSounds[aI].ALSource, AL_GAIN, 1 * fALSounds[aI].Volume * fSoundGain);
     end;
   
   var I: Integer;
  
positive.code:     W := gRes.Sounds.fWaves[ID];
  
      Assert(W.IsLoaded and (ID <= gRes.Sounds.fWavesCount), 'Sounds.dat seems to be short');
      AlBufferData(fSound[FreeBuf].ALBuffer, AL_FORMAT_MONO8, @W.Data[0], W.Head.DataSize, W.Head.SampleRate);
      WAVsize := W.Head.FileSize;
      WAVfreq := W.Head.BytesPerSecond;
      WAVDuration := round(WAVsize / WAVfreq * 1000);
    end;
  
    //Set source properties
    AlSourcei(fSound[FreeBuf].ALSource, AL_BUFFER, fSound[FreeBuf].ALBuffer);
    AlSourcef(fSound[FreeBuf].ALSource, AL_PITCH, 1);
    AlSourcef(fSound[FreeBuf].ALSource, AL_GAIN, 1 * Volume * fSoundGain);
    if Attenuated then
    begin
      Dif[1]:=Loc.X; Dif[2]:=Loc.Y; Dif[3]:=0;
      AlSourcefv(fSound[FreeBuf].ALSource, AL_POSITION, @Dif[1]);
      AlSourcei(fSound[FreeBuf].ALSource, AL_SOURCE_RELATIVE, AL_FALSE); //If Attenuated then it is not relative to the listener
    end else
    begin
      //For sounds that do not change over distance, set to SOURCE_RELATIVE and make the position be 0,0,0 which means it will follow the listener
      //Do not simply set position to the listener as the listener could change while the sound is playing
      Dif[1]:=0; Dif[2]:=0; Dif[3]:=0;
      AlSourcefv(fSound[FreeBuf].ALSource, AL_POSITION, @Dif[1]);
      AlSourcei(fSound[FreeBuf].ALSource, AL_SOURCE_RELATIVE, AL_TRUE); //Relative to the listener, meaning it follows us
    end;
    AlSourcef(fSound[FreeBuf].ALSource, AL_REFERENCE_DISTANCE, 4);
    AlSourcef(fSound[FreeBuf].ALSource, AL_MAX_DISTANCE, Radius);
    AlSourcef(fSound[FreeBuf].ALSource, AL_ROLLOFF_FACTOR, 1);
  
    if aLooped then
      AlSourcei(fSound[FreeBuf].ALSource, AL_LOOPING, AL_TRUE)
    else
      AlSourcei(fSound[FreeBuf].ALSource, AL_LOOPING, AL_FALSE);
  
    //Start playing
    AlSourcePlay(fSound[FreeBuf].ALSource);
    if SoundID <> sfxNone then
      fSound[FreeBuf].Name := GetEnumName(TypeInfo(TSoundFX), Integer(SoundID))
    else
      fSound[FreeBuf].Name := ExtractFileName(aFile);
    fSound[FreeBuf].Position := Loc;
    fSound[FreeBuf].Duration := WAVDuration;
    fSound[FreeBuf].PlaySince := TimeGet;
    fSound[FreeBuf].Volume := Volume;
    fSound[FreeBuf].FromScript := aFromScript;
    fSound[FreeBuf].Looped := aLooped;
    fSound[FreeBuf].FadesMusic := FadeMusic;
  
    Result := FreeBuf;
  end;
  
negative.code:   begin
      for I := 1 to MAX_SOUNDS do
      begin
        AlDeleteBuffers(1, @fALSounds[I].ALBuffer);
        AlDeleteSources(1, @fALSounds[I].ALSource);
      end;
      AlutExit;
    end;
  