1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
procedure TForm1.btJouerClick(Sender: TObject);
begin
Lecteur;
end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if (Key <> chr(8)) and ((Key < '0') or (Key > '9')) then
begin
Key := chr(0);
end;
end;
procedure TForm1.Lecteur;
begin
if RadioBtmont.Checked then
begin
Arretautorise := true;
MediaPlayer1.FileName := 'C:\Sons expérience\MONTE.wav';
MediaPlayer1.Open;
B:= StrToInt(Edit1.Text);
MediaPlayer1.Play;
if B <> 1 then
begin
MediaPlayer1.Notify := true;
MediaPlayer1.OnNotify := NotifyProc1
end;
end;
if RadioBtdesc.Checked then
begin
Arretautorise := true;
MediaPlayer1.FileName := 'C:\Sons expérience\DESC.WAV';
MediaPlayer1.Open;
C:= StrToInt(Edit2.Text);
MediaPlayer1.Play;
if C <> 1 then
begin
MediaPlayer1.Notify := true;
MediaPlayer1.OnNotify := NotifyProc2;// Appel de la procédure NotifyProc
end;
end;
end;
procedure TForm1.NotifyProc1(Sender: TObject);
begin
with Sender as TMediaPlayer do
begin
if NotifyValue = nvSuccessful then // Nouvelle ligne
begin
Dec(B);
if B > 0 then
begin
Play;
end;
end;
Notify := True;
end;
end;
procedure TForm1.NotifyProc2(Sender: TObject);
begin
with Sender as TMediaPlayer do
begin
if NotifyValue = nvSuccessful then // Nouvelle ligne
begin
Dec(C);
if C > 0 then
begin
Play;
end;
end;
Notify := True;
end;
end;
procedure TForm1.btArreterClick(Sender: TObject);
begin
if Arretautorise then
begin
MediaPlayer1.Stop;
end;
end; |