Lazarus

Programming => Operating Systems => Android => Topic started by: xinyiman on December 06, 2021, 03:10:18 pm

Title: (SOLVED) Beep
Post by: xinyiman on December 06, 2021, 03:10:18 pm
Hello to all. Can anyone tell me how I can emit a simple beep?
Title: Re: Beep
Post by: howardpc 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 (https://forum.lazarus.freepascal.org/index.php/topic,56093.msg416924.html#msg416924)
Title: Re: Beep
Post by: xinyiman on December 06, 2021, 03:25:11 pm
sysutils.beep run on android?!
Title: Re: Beep
Post by: loaded 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.  
Title: Re: Beep
Post by: Thaddy 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.
Title: Re: Beep
Post by: loaded 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.
Title: Re: Beep
Post by: BobDog 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.  
Title: Re: Beep
Post by: jmpessoa 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?
Title: Re: Beep
Post by: jmpessoa on December 07, 2021, 05:51:47 am
Done!

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

New! demo "AppToneGeneratorDemo1"


Thanks to All!
Title: Re: Beep
Post by: xinyiman on December 07, 2021, 08:37:51 am
Thank you is perfect
Title: Re: (SOLVED) Beep
Post by: loaded on December 07, 2021, 12:36:13 pm
Words are not enough to thank you, master jmpessoa. Thank you very much.
TinyPortal © 2005-2018