unit Sound;

interface

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

Procedure PSoundY(music : string);
Procedure PMusic(music : string);
Procedure LMusic(music : string);
Procedure PSoundY2(music : string);


implementation
uses Otshelm_A, Mform, Setup;

Procedure PMusic(music : string);
begin
  GamerMusic.Behaviours.Clear;
  with TGLBSoundEmitter.Create(GamerMusic.Behaviours) do begin
      Source.SoundLibrary:=Oform.GLSoundLibrary1;
      Source.SoundName:=music+'.mp3';
      Source.Volume:=0.1*Setup.Music;
      Source.Nbloops:=3;
      Playing:=True;
   end;
end;

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

Procedure PSoundY2(music : string);
begin
  GamerSound2.Behaviours.Clear;
  with TGLBSoundEmitter.Create(GamerSound2.Behaviours) do begin
      Source.SoundLibrary:=Oform.GLSoundLibrary1;
      Source.SoundName:=music+'.mp3';
      Source.Nbloops:=3;
      Source.Volume:=0.1*Setup.Sound;
      Playing:=True;
   end;
end;

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