Recent

Author Topic: (SOLVED) Beep  (Read 5684 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2185
    • Lazarus and Free Pascal italian community
(SOLVED) Beep
« on: December 06, 2021, 03:10:18 pm »
Hello to all. Can anyone tell me how I can emit a simple beep?
« Last Edit: December 07, 2021, 08:38:03 am by xinyiman »
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

howardpc

  • Hero Member
  • *****
  • Posts: 3860
Re: Beep
« Reply #1 on: December 06, 2021, 03:14:39 pm »
1) Eat a lot of curried beans and cabbage
2) See this thread https://forum.lazarus.freepascal.org/index.php/topic,56093.msg416924.html#msg416924

xinyiman

  • Hero Member
  • *****
  • Posts: 2185
    • Lazarus and Free Pascal italian community
Re: Beep
« Reply #2 on: December 06, 2021, 03:25:11 pm »
sysutils.beep run on android?!
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

loaded

  • Sr. Member
  • ****
  • Posts: 441
Re: Beep
« Reply #3 on: December 06, 2021, 03:53:28 pm »
If I'm not mistaken, sysutils.beep doesn't work on android. It does not give an error, but it does not give sound.
An example study about sound;
lazandroidmodulewizard-master\demos\GUI\AppSoundPoolDemo
You can find it on the way.

Or a hybrid application
Code: Pascal  [Select][+][-]
  1. ToneGenerator toneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);
  2. toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);
  3. toneG.release();
  4.  
If Ide=Lazarus 2.0.10 32 Bit and Os=Win 10 Home 64 Bit then Get up and do something useful! Because God is the helper of those who start again;

Thaddy

  • Hero Member
  • *****
  • Posts: 11150
Re: Beep
« Reply #4 on: December 06, 2021, 04:15:59 pm »
Indeed for Android and nixes it is a stub. Empty procedure. You can simply examine the rtl sources to see that.
You have morons, I am one, and you have morons squared.

loaded

  • Sr. Member
  • ****
  • Posts: 441
Re: Beep
« Reply #5 on: December 06, 2021, 04:51:43 pm »
Indeed for Android and nixes it is a stub. Empty procedure. You can simply examine the rtl sources to see that.
Now it's clear why it wasn't working. I can use the above Java code in my projects without any problems, but for other friends, master jmpessoa can add this ability by adding the above java code (there is definitely a method he knows better) to LAMW with a magic touch.
If Ide=Lazarus 2.0.10 32 Bit and Os=Win 10 Home 64 Bit then Get up and do something useful! Because God is the helper of those who start again;

BobDog

  • Full Member
  • ***
  • Posts: 183
Re: Beep
« Reply #6 on: December 06, 2021, 07:09:02 pm »

external 'msvcrt.dll' for win
external 'c' for Linux (..I think?..)
Code: Pascal  [Select][+][-]
  1. procedure sound (freq:integer;duration:integer)cdecl external 'msvcrt.dll' name '_beep';
  2.  
  3. begin
  4. sound(1000,200); //close to standard beep
  5. writeln ('Press enter to end . . .');
  6. readln
  7. end.
  8.  

jmpessoa

  • Hero Member
  • *****
  • Posts: 2052
Re: Beep
« Reply #7 on: December 06, 2021, 08:54:32 pm »
Quote
jmpessoa can add this ability by adding the above java code (there is definitely a method he knows better) to LAMW with a magic touch...

 :D :D :D :D

But find a good icon for a new jToneGenerator component is very difficult!

What about this one in attachment?  Some others suggestions?
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

jmpessoa

  • Hero Member
  • *****
  • Posts: 2052
Re: Beep
« Reply #8 on: December 07, 2021, 05:51:47 am »
Done!

NEW! component jToneGenerator    [tab "Android Bridge Extra"]

New! demo "AppToneGeneratorDemo1"


Thanks to All!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

xinyiman

  • Hero Member
  • *****
  • Posts: 2185
    • Lazarus and Free Pascal italian community
Re: Beep
« Reply #9 on: December 07, 2021, 08:37:51 am »
Thank you is perfect
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

loaded

  • Sr. Member
  • ****
  • Posts: 441
Re: (SOLVED) Beep
« Reply #10 on: December 07, 2021, 12:36:13 pm »
Words are not enough to thank you, master jmpessoa. Thank you very much.
If Ide=Lazarus 2.0.10 32 Bit and Os=Win 10 Home 64 Bit then Get up and do something useful! Because God is the helper of those who start again;

 

TinyPortal © 2005-2018