2018-03-15 12:43:17 +03:00
|
|
|
|
unit Sounds;
|
|
|
|
|
|
|
|
|
|
|
|
{$reference 'PresentationCore.dll'}
|
|
|
|
|
|
|
|
|
|
|
|
procedure PlaySound(fname: string);
|
|
|
|
|
|
begin
|
|
|
|
|
|
var fsound := new System.Windows.Media.MediaPlayer;
|
2018-03-22 10:31:16 +03:00
|
|
|
|
fsound.Open(new System.Uri(fname,System.UriKind.RelativeOrAbsolute));
|
2018-03-15 12:43:17 +03:00
|
|
|
|
fsound.Play;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
type Sound = class
|
|
|
|
|
|
fsound := new System.Windows.Media.MediaPlayer;
|
|
|
|
|
|
public
|
|
|
|
|
|
constructor (fname: string);
|
|
|
|
|
|
begin
|
|
|
|
|
|
Open(fname);
|
|
|
|
|
|
end;
|
2018-03-22 10:31:16 +03:00
|
|
|
|
procedure Open(fname: string) := fsound.Open(new System.Uri(fname,System.UriKind.RelativeOrAbsolute));
|
2018-03-15 12:43:17 +03:00
|
|
|
|
procedure Play := fsound.Play;
|
|
|
|
|
|
procedure Stop := fsound.Stop;
|
|
|
|
|
|
procedure Pause := fsound.Pause;
|
|
|
|
|
|
procedure Reset := fsound.Position := new System.Timespan(0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|