Re: [Lazarus] Beep?

2018-03-29 Thread Donald Ziesig via Lazarus

On 03/29/2018 06:12 AM, Carlos E. R. via Lazarus wrote:

-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

-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Beep?

2018-03-29 Thread Carlos E. R. via Lazarus

-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--- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Beep?

2018-03-27 Thread Landmesser John via Lazarus

perhaps:

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


Am 26.03.2018 um 04:02 schrieb Donald Ziesig via Lazarus:


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







-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Beep?

2018-03-26 Thread Marc Santhoff via Lazarus
(sending again from the subscribed mail address...
 if moderation is active, please drop the other mail - sorry and thanks)


On Sun, 2018-03-25 at 22:02 -0400, Donald Ziesig via Lazarus wrote:
> 
> Any suggestions would be appreciated.

Make sure your computer can beep? (speaker connected, etc.)

Try "writeln(#07)"?

Check if X has beeps switched off ("xset -b")?

HTH anyhow,
Marc

-- 
Marc Santhoff 
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Beep?

2018-03-25 Thread Carlos E. R. via Lazarus
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.

-- 
Cheers / Saludos,

Carlos E. R.
(from 42.3 x86_64 "Malachite" at Telcontar)



signature.asc
Description: OpenPGP digital signature
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus