Android Question [Closed] Beep and Sleep

Roger Daley

Well-Known Member
Licensed User
Longtime User
Hi All

A small problem. In the code below I flash the text in an edit text and button and sound beeps to alert the user to enter a value for a variable.
In the code I should get 3 beeps. Sometimes I get 2 or 4 beeps. I know it has something to do with the durations of the Beep and the Sleep [resumable subs) but can't find a solution.


B4X:
  If VarExists = 0 Then                        '1st time this VAR appears in this PGM, add to reg and enter value)

                    VarReg(VarReg_flag, 0) = VariableName

                    Idisplay.Text = Recording(FNum, Step_count, 1) & " = ?"

                    BtnVarEnt.BringToFront

                 

                    For I = 0 To 7                        

                        Idisplay.TextColor = Colors.Red

                        BtnVarEnt.TextColor = Colors.Black

                        If I < 2 Then Beep1.Beep

                        Sleep(150)                    

                     

                        Idisplay.TextColor = Colors.Black

                        BtnVarEnt.TextColor = BVE

                        If I < 1 Then Beep1.Beep

                        Sleep(150)                

                    Next

                 

                    Return

       End If


Regards Roger
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Best is to reproduce it in a small project and upload it
 
Upvote 0

Serge Bertet

Active Member
Licensed User
I know it has something to do with the durations of the Beep
Yes, with 50ms duration it starts to work almost fine, 80ms is better.
It is also working better in realease than debug mode.
Sound is not nice at all 😱 1000Hz is slightly better.
if I had to do that I would make an MP3 or WAV file with 3 beeps.
 
Upvote 0
Top