Hey everybody,
I tried to create a trial app which a beeper sound plays when a user touches the activity in two different areas. I've came up with the following but the response is not good enough as a minor time interval is apparent between the ending of the first and the beginning of the other and further more if the toughing is really brief no sound is heard. Is there a way to overcome this?
This is the code:
I tried to create a trial app which a beeper sound plays when a user touches the activity in two different areas. I've came up with the following but the response is not good enough as a minor time interval is apparent between the ending of the first and the beginning of the other and further more if the toughing is really brief no sound is heard. Is there a way to overcome this?
This is the code:
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
Private note1 As Beeper
Private ScreenWidth As Long
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
Dim lv As LayoutValues
lv = GetDeviceLayoutValues
ScreenWidth = lv.Width
End Sub
Sub Activity_Touch (Action As Int, X As Float, Y As Float)
Select Action
Case Activity.ACTION_DOWN
If x < 0.5 * ScreenWidth Then
note1.Initialize(60000, 440)
note1.beep
Else
note1.Initialize(60000, 880)
note1.beep
End If
Case Activity.ACTION_UP
Try
note1.Release
Catch
Log(LastException)
End Try
End Select
End Sub
Last edited: