unit Sound;

interface

uses
  Classes, ExtCtrls, Forms, GLCadencer, GLScene, GLObjects, GLMisc,
  GLSound, GLSMFMOD, ComCtrls, Controls, GLSMBASS, StdCtrls,SysUtils, GLWin32Viewer,
  GLGeomObjects;

Procedure PSoundY(music : string);
Procedure PSoundY2(music : string);
Procedure PMusic(music : string);
Procedure PSound(music : string; n: integer);
Procedure PSoundO(music : string);
Procedure LMusic(music : string);

 var
// MCube: array[1..] of TGlDummyCube;
 KolCube:integer;
implementation
uses Main, Script,Init, Ai,Gamer, Shoot, World;

Procedure PMusic(music : string);
begin
  Gamer.Music.Behaviours.Clear;
  with TGLBSoundEmitter.Create(Gamer.Music.Behaviours) do begin
      Source.SoundLibrary:=Mform.GLSoundLibrary1;
      Source.SoundName:=music+'.mp3';
      Source.Volume:=0.1*Init.Music;
      Source.Nbloops:=3;

      Playing:=True;
   end;
end;

Procedure PSoundY(music : string);
begin
  Gamer.Sound.Behaviours.Clear;
  with TGLBSoundEmitter.Create(Gamer.Sound.Behaviours) do begin
      Source.SoundLibrary:=Mform.GLSoundLibrary1;
      Source.SoundName:=music+'.mp3';
      Source.Nbloops:=0;
      Source.Volume:=0.1*Init.Talk;
      Playing:=True;
   end;
end;

Procedure PSoundY2(music : string);
begin
  Gamer.Sound2.Behaviours.Clear;
  with TGLBSoundEmitter.Create(Gamer.Sound2.Behaviours) do begin
      Source.SoundLibrary:=Mform.GLSoundLibrary1;
      Source.SoundName:=music+'.mp3';
      Source.Nbloops:=0;
      Source.Volume:=0.1*Init.Sound;
      Playing:=True;
   end;
end;

Procedure PSound(music : string; n: integer);
begin
Ai.AiBOT[n].Shadow.Behaviours.Clear;
  with TGLBSoundEmitter.Create(Ai.AiBOT[n].Shadow.Behaviours) do begin
      Source.SoundLibrary:=MForm.GLSoundLibrary1;
      Source.SoundName:=music+'.mp3';
      Source.Nbloops:=0;
      Source.Volume:=0.1*Init.Talk;
      Playing:=True;
   end;
end;

Procedure PSoundO(music : string);
begin
if World.GWorld[Script.SD].Fisika='NOF' then
Script.pickW.Behaviours.Clear;
  with TGLBSoundEmitter.Create(Script.pickW.Behaviours) do begin
      Source.SoundLibrary:=MForm.GLSoundLibrary1;
      Source.SoundName:=music+'.mp3';
      Source.Volume:=0.1*Init.Sound;
      Source.Nbloops:=0;
      Playing:=True;
   end;
end;

Procedure LMusic(music : string);
begin
  SetCurrentDir(ExtractFilePath(Application.ExeName)+'\Sound\');
  if FileExists(ExtractFilePath(Application.ExeName)+'\Sound\'+music+'.mp3')
  then
  MForm.GLSoundLibrary1.Samples.AddFile(music+'.mp3')
end;
end.
