<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 03/29/2018 06:12 AM, Carlos E. R.
via Lazarus wrote:<br>
</div>
<blockquote type="cite"
cite="mid:alpine.LSU.2.21.1803291157350.28445@Telcontar.valinor">-----BEGIN
PGP SIGNED MESSAGE-----
<br>
Hash: SHA1
<br>
<br>
<br>
<br>
On Monday, 2018-03-26 at 06:09 +0200, Carlos E. R. via Lazarus
wrote:
<br>
<br>
<blockquote type="cite">On 2018-03-26 04:02, Donald Ziesig via
Lazarus wrote:
<br>
<blockquote type="cite">Hi Everyone!
<br>
<br>
I am using Lazarus 1.8 on Linux Mint. I would like to use the
<br>
Windows.Beep( Freq, Duration) function, or (if not available)
<br>
SysUtils.Beep subprograms.
<br>
</blockquote>
<br>
AFAIK, you can not call Windows functions in Linux.
<br>
</blockquote>
<br>
Further, my understanding is that the loudspeaker is associated to
the terminal in Linux. You can not thus beep from a daemon,
something that would be useful. We apparently do not get access to
program the chip as in MsDOS, nor freq,duration.
<br>
<br>
<br>
Here I post an attempt I did back on 2005. It doesn't compile, and
this moment I can't check why. Nor, of course, do I remember what
I was trying.
<br>
<br>
program beeper;
<br>
<br>
uses linux;
<br>
<br>
var
<br>
Saved43, Saved61: byte;
<br>
LoadClock: word;
<br>
frequency: word;
<br>
duration: real;
<br>
RequestedDuration, RemainingDuration: timespec;
<br>
<br>
hh,mm,ss, msec, usec: word;
<br>
begin
<br>
(*
<br>
if paramcount <> 2 then begin
<br>
writeln('Produces a beep of the indicated
frequency and duration.');
<br>
writeln('Usage: beeper frequency duration');
<br>
halt(1);
<br>
end;
<br>
<br>
<br>
frequency:= round(ParamStr(1));
<br>
duration:= ParamStr(2);
<br>
*)
<br>
<br>
frequency:= 500;
<br>
duration:= 1.2;
<br>
<br>
<br>
RequestedDuration.tv_sec:= trunc(duration);
<br>
RequestedDuration.tv_nsec:= trunc(frac(duration)*1e9);
<br>
<br>
{ioperm(from, num, value)}
<br>
writeln($61, ' ', $42);
<br>
writeln(ioperm($61, 1, 1), ' ', ioperm($42, 2, 1));
<br>
<br>
{timer prepare}
<br>
ReadPort($43, Saved43);
<br>
writeln('43h', ' ', Saved43);
<br>
writeport($43, byte($B6)); {Channel 2, LSB/MSB}
<br>
<br>
LoadClock:= 1193180 div frequency;
<br>
writeport($42, Lo(LoadClock));
<br>
writeport($42, Hi(LoadClock));
<br>
<br>
ReadPort($61, Saved61);
<br>
writeln('61h', ' ', Saved61);
<br>
writeport($61, byte(Saved61 or $3)); {Speaker on}
<br>
<br>
<br>
{Select(0, nil, nil, nil, 1000);}
<br>
gettime(hh,mm,ss, msec, usec);
<br>
writeln(hh,':', mm, ':', ss, '.', msec, ' ', usec);
<br>
nanosleep(RequestedDuration, RemainingDuration);
<br>
gettime(hh,mm,ss, msec, usec);
<br>
writeln(hh,':', mm, ':', ss, '.', msec, ' ', usec);
<br>
<br>
writeport($61, Saved61); {Speaker off}
<br>
<br>
end.
<br>
<br>
<br>
I also have copies of some c code I got from fidonet posts that I
can look at another day, in assembler. I don't remember if they
worked, probably not.
<br>
<br>
<br>
- -- Cheers,
<br>
Carlos E. R.
<br>
(from openSUSE 42.3 x86_64 "Malachite" at Telcontar)
<br>
<br>
-----BEGIN PGP SIGNATURE-----
<br>
Version: GnuPG v2
<br>
<br>
iEYEARECAAYFAlq8vCgACgkQtTMYHG2NR9W0MQCfW3PJfWFopnrWMV9V+bCcA1ZQ
<br>
2goAn3C6b2V2kwsunTiqB5o1vIQIaF8H
<br>
=v6dw
<br>
-----END PGP SIGNATURE-----<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<p>Thanks Carlos!</p>
<p>I am presently recovering from surgery and taking medication for
pain. I will try your suggestion once my pain is gone and I can
think straight <span class="moz-smiley-s3"><span>;-)</span></span>.</p>
<p>Don<br>
</p>
</body>
</html>