Page 1 of 1

[WA] Loop sound

PostPosted: April 6th, 2004, 8:36 am
by piotr
Congratulations, WA is very god job.

However, i'm looking for simple method to loop played sounds, when i simply try to add Active:= True in OnDeactivate event, i recived out of memory error.

PostPosted: April 11th, 2004, 2:22 pm
by Kambiz
I did it in the following way, and it worked.

Code: Select all
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, WaveIO, WaveOut, WavePlayers;

type
  TForm1 = class(TForm)
    AudioPlayer: TAudioPlayer;
    cbActive: TCheckBox;
    procedure AudioPlayerDeactivate(Sender: TObject);
    procedure cbActiveClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.AudioPlayerDeactivate(Sender: TObject);
begin
  AudioPlayer.Active := cbActive.Checked;
end;

procedure TForm1.cbActiveClick(Sender: TObject);
begin
  AudioPlayer.Active := cbActive.Checked;
end;

end.