anchor.diff:  
   { TKMSoundPlayer }
   constructor TKMSoundPlayer.Create(aVolume: Single);
  -var
  -  I: Integer;
  -  context: PALCcontext;
  -  numMono, numStereo: TALCint;
   begin
     inherited Create;
   
  -  for I := Low(fScriptSoundALIndex) to High(fScriptSoundALIndex) do
  -    fScriptSoundALIndex[I] := -1;
  -
  -  if SKIP_SOUND then Exit;
  -
  -  fIsSoundInitialized := InitOpenAL;
  -  Set8087CW($133F); //Above OpenAL call messes up FPU settings
  -  if not fIsSoundInitialized then
  -  begin
  -    gLog.AddNoTime('OpenAL warning. OpenAL could not be initialized.');
  -    //MessageDlg works better than Application.MessageBox or others, it stays on top and pauses here until the user clicks ok.
  -    MessageDlg('OpenAL could not be initialized. Please refer to Readme.html for solution', mtWarning, [mbOk], 0);
  -    fIsSoundInitialized := False;
  -    Exit;
  -  end;
  -
  -  // Open device (this is quite slow, 700-800 ms)
  -  //todo -cPractical: OpenAL init can be perfomed in a thread
  -  fALDevice := alcOpenDevice(nil); // this is supposed to select the "preferred device"
  -  Set8087CW($133F); //Above OpenAL call messes up FPU settings
  -  if fALDevice = nil then
  -  begin
  -    gLog.AddNoTime('OpenAL warning. Device could not be opened.');
  -    //MessageDlg works better than Application.MessageBox or others, it stays on top and pauses here until the user clicks ok.
  -    MessageDlg('OpenAL device could not be opened. Please refer to Readme.html for solution', mtWarning, [mbOk], 0);
  -    fIsSoundInitialized := False;
  -    Exit;
  -  end;
  -
  -  // Create context
  -  context := alcCreateContext(fALDevice, nil);
  -  Set8087CW($133F); //Above OpenAL call messes up FPU settings
  -  if context = nil then
  -  begin
  -    gLog.AddNoTime('OpenAL warning. Context could not be created.');
  -    //MessageDlg works better than Application.MessageBox or others, it stays on top and pauses here until the user clicks ok.
  -    MessageDlg('OpenAL context could not be created. Please refer to Readme.html for solution', mtWarning, [mbOk], 0);
  -    fIsSoundInitialized := False;
  -    Exit;
  -  end;
  -
  -  // Set active context
  -  I := alcMakeContextCurrent(context);
  -  Set8087CW($133F); //Above OpenAL call messes up FPU settings
  -  if not (I in [AL_NO_ERROR, AL_TRUE]) then
  -  begin
  -    gLog.AddNoTime('OpenAL warning. Context could not be made current.');
  -    //MessageDlg works better than Application.MessageBox or others, it stays on top and pauses here until the user clicks ok.
  -    MessageDlg('OpenAL context could not be made current. Please refer to Readme.html for solution', mtWarning, [mbOk], 0);
  -    fIsSoundInitialized := False;
  -    Exit;
  -  end;
  -
  -  CheckOpenALError;
  -  if not fIsSoundInitialized then Exit;
  -
  -  // Set attenuation model
  -  alDistanceModel(AL_LINEAR_DISTANCE_CLAMPED);
  -  gLog.AddTime('Pre-LoadSFX init', True);
  -
  -  alcGetIntegerv(fALDevice, ALC_MONO_SOURCES, 4, @numMono);
  -  alcGetIntegerv(fALDevice, ALC_STEREO_SOURCES, 4, @numStereo);
  -
  -  gLog.AddTime('ALC_MONO_SOURCES',numMono);
  -  gLog.AddTime('ALC_STEREO_SOURCES',numStereo);
  -
  -  for I := Low(fALSounds) to High(fALSounds) do
  -  begin
  -    AlGenBuffers(1, @fALSounds[i].ALBuffer);
  -    AlGenSources(1, @fALSounds[i].ALSource);
  -  end;
  -
  -  CheckOpenALError;
  -  if not fIsSoundInitialized then Exit;
  -
  -  // Set default Listener orientation
  -  fListener.Ori[1] := 0; fListener.Ori[2] := 0; fListener.Ori[3] := -1; //Look-at vector
  -  fListener.Ori[4] := 0; fListener.Ori[5] := 1; fListener.Ori[6] := 0; //Up vector
  -  AlListenerfv(AL_ORIENTATION, @fListener.Ori);
  +  Init;
  +
     fVolume := aVolume;
     fPrevVolume := aVolume;
  -
  -  gLog.AddTime('OpenAL init done');
   end;
   
   
  
positive.code:     procedure SetMuted(const aMuted: Boolean);
  
      function GetPrevVolume: Single;
  
      property PrevVolume: Single read GetPrevVolume write fPrevVolume;
    public
      constructor Create(aVolume: Single);
      destructor Destroy; override;
  
negative.code: function TKMSoundPlayer.GetPrevVolume: Single;
  begin
    Result := IfThen(fPrevVolume = 0, 0.5, fPrevVolume);
  end;
  
  
  function TKMSoundPlayer.GetIsReady: Boolean;
  begin
    Result := fInitComplete and fIsSoundInitialized;
  end;
  
  
  