Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2018-03

Beep?

6 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Donald Ziesig

Hi Everyone!

I am using Lazarus 1.8 on Linux Mint.  I would like to use the Windows.Beep( Freq, Duration) function, or (if not available) SysUtils.Beep subprograms.

Simplest problem.  SysUtils.Beep compiles and links but is silent.

Slightly more difficult (according to StackOverflow)

I should be able to insert (manually) Windows in the uses clause, then call the windows.beep( f, d) function, but fcp can't find Windows even though there are several windows.pp files in the fpcscr directories.

Failing that, the article says:

|functionBeep(dwFreq,dwDuration:DWORD):BOOL;stdcall;external'kernel32.dll';|

should work, but it causes a linker error after compilation.  I don't have lernel32.dll on my Linux system.

A long time ago, I used the Windows.Beep (on windows) to produce Morse Code error messages while debugging visual components.  I would like to do that now if possible, but on Linux.

Any suggestions would be appreciated.

Thanks,

Don Ziesig

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180325/63195302/attachment.html>

Reply by email

Carlos E. R.
to Donald Ziesig
Donald Ziesig wrote 5 lines
Hi Everyone! I am using Lazarus 1.8 on Linux Mint.  I would like to use the Windows.Beep( Freq, Duration) function, or (if not available) SysUtils.Beep subprograms.

AFAIK, you can not call Windows functions in Linux.

Cheers / Saludos, Carlos E. R. (from 42.3 x86_64 "Malachite" at Telcontar) -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: OpenPGP digital signature URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180326/8d78749d/attachment.sig>

Reply by email

Landmesser John
to Donald Ziesig: Hi Everyone! I am using Lazarus 1.8 on Linux Mint.  I would like to use the…

perhaps:

* A simple visual component to play WAVe files in Windows or Linux
* For more information, see: http://wiki.freepascal.org/TPlaySound

Donald Ziesig wrote 36 lines
Hi Everyone! I am using Lazarus 1.8 on Linux Mint.  I would like to use the Windows.Beep( Freq, Duration) function, or (if not available) SysUtils.Beep subprograms. Simplest problem.  SysUtils.Beep compiles and links but is silent. Slightly more difficult (according to StackOverflow) I should be able to insert (manually) Windows in the uses clause, then call the windows.beep( f, d) function, but fcp can't find Windows even though there are several windows.pp files in the fpcscr directories. Failing that, the article says: |functionBeep(dwFreq,dwDuration:DWORD):BOOL;stdcall;external'kernel32.dll';| should work, but it causes a linker error after compilation.  I don't have lernel32.dll on my Linux system. A long time ago, I used the Windows.Beep (on windows) to produce Morse Code error messages while debugging visual components.  I would like to do that now if possible, but on Linux. Any suggestions would be appreciated. Thanks, Don Ziesig

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180327/1c2c3d4e/attachment-0001.html>

Reply by email

Carlos E. R.
to Carlos E. R.: AFAIK, you can not call Windows functions in Linux. Carlos E. R. (from 42.3 x86_64…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Carlos E. R. wrote 8 lines
On 2018-03-26 04:02, Donald Ziesig via Lazarus wrote: > Hi Everyone! > > I am using Lazarus 1.8 on Linux Mint.  I would like to use the > Windows.Beep( Freq, Duration) function, or (if not available) > SysUtils.Beep subprograms. AFAIK, you can not call Windows functions in Linux.

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.

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.

program beeper;
uses linux;
var
         Saved43, Saved61: byte;
         LoadClock: word;
         frequency: word;
         duration:  real;
         RequestedDuration, RemainingDuration: timespec;
         hh,mm,ss, msec, usec: word;
begin
(*
         if paramcount  2 then begin
                 writeln('Produces a beep of the indicated frequency and
duration.');
                 writeln('Usage: beeper frequency duration');
                 halt(1);
         end;
         frequency:= round(ParamStr(1));
         duration:= ParamStr(2);
*)
         frequency:= 500;
         duration:=  1.2;
         RequestedDuration.tv_sec:=      trunc(duration);
         RequestedDuration.tv_nsec:=     trunc(frac(duration)*1e9);
         {ioperm(from, num, value)}
         writeln($61, '   ', $42);
         writeln(ioperm($61, 1, 1), ' ', ioperm($42, 2, 1));
                 {timer prepare}
         ReadPort($43, Saved43);
         writeln('43h', ' ', Saved43);
         writeport($43, byte($B6));      {Channel 2, LSB/MSB}
         LoadClock:= 1193180 div frequency;
         writeport($42, Lo(LoadClock));
         writeport($42, Hi(LoadClock));
         ReadPort($61, Saved61);
         writeln('61h', ' ', Saved61);
         writeport($61, byte(Saved61 or $3));    {Speaker on}
                 {Select(0, nil, nil, nil, 1000);}
         gettime(hh,mm,ss, msec, usec);
         writeln(hh,':', mm, ':', ss, '.', msec, ' ', usec);
         nanosleep(RequestedDuration, RemainingDuration);
         gettime(hh,mm,ss, msec, usec);
         writeln(hh,':', mm, ':', ss, '.', msec, ' ', usec);
         writeport($61, Saved61);        {Speaker off}
end.

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.

- --
Cheers,
Carlos E. R.
(from openSUSE 42.3 x86_64 "Malachite" at Telcontar)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlq8vCgACgkQtTMYHG2NR9W0MQCfW3PJfWFopnrWMV9V+bCcA1ZQ 2goAn3C6b2V2kwsunTiqB5o1vIQIaF8H
=v6dw
-----END PGP SIGNATURE-----

Reply by email

Donald Ziesig
to Carlos E. R.
Carlos E. R. wrote 107 lines
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday, 2018-03-26 at 06:09 +0200, Carlos E. R. via Lazarus wrote: > On 2018-03-26 04:02, Donald Ziesig via Lazarus wrote: >> Hi Everyone! >> >> I am using Lazarus 1.8 on Linux Mint.  I would like to use the >> Windows.Beep( Freq, Duration) function, or (if not available) >> SysUtils.Beep subprograms. > > AFAIK, you can not call Windows functions in Linux. 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. 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. program beeper; uses linux; var         Saved43, Saved61: byte;         LoadClock: word;         frequency: word;         duration:  real;         RequestedDuration, RemainingDuration: timespec;         hh,mm,ss, msec, usec: word; begin (*         if paramcount 2 then begin                 writeln('Produces a beep of the indicated frequency and duration.');                 writeln('Usage: beeper frequency duration');                 halt(1);         end;         frequency:= round(ParamStr(1));         duration:= ParamStr(2); *)         frequency:= 500;         duration:=  1.2;         RequestedDuration.tv_sec:=      trunc(duration);         RequestedDuration.tv_nsec:=     trunc(frac(duration)*1e9);         {ioperm(from, num, value)}         writeln($61, '   ', $42);         writeln(ioperm($61, 1, 1), ' ', ioperm($42, 2, 1));                 {timer prepare}         ReadPort($43, Saved43);         writeln('43h', ' ', Saved43);         writeport($43, byte($B6));      {Channel 2, LSB/MSB}         LoadClock:= 1193180 div frequency;         writeport($42, Lo(LoadClock));         writeport($42, Hi(LoadClock));         ReadPort($61, Saved61);         writeln('61h', ' ', Saved61);         writeport($61, byte(Saved61 or $3));    {Speaker on}                 {Select(0, nil, nil, nil, 1000);}         gettime(hh,mm,ss, msec, usec);         writeln(hh,':', mm, ':', ss, '.', msec, ' ', usec);         nanosleep(RequestedDuration, RemainingDuration);         gettime(hh,mm,ss, msec, usec);         writeln(hh,':', mm, ':', ss, '.', msec, ' ', usec);         writeport($61, Saved61);        {Speaker off} end. 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. - -- Cheers,        Carlos E. R.        (from openSUSE 42.3 x86_64 "Malachite" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlq8vCgACgkQtTMYHG2NR9W0MQCfW3PJfWFopnrWMV9V+bCcA1ZQ 2goAn3C6b2V2kwsunTiqB5o1vIQIaF8H =v6dw -----END PGP SIGNATURE-----

Thanks Carlos!

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 ;-).

Don

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180329/ef5e3acc/attachment-0001.html>

Reply by email