B4A Library Standard Click Sound Library

Hi,
Attached is a very small library which generates the standard 'click' sounds as defined by the AudioManager in Android from API 1.
It is very simple to use.
B4X:
Dim myclick As esClickSound
   
   myclick.Initialize
Then to use its;
B4X:
myclick.standardFx(0.5)
The value passed is a float with a value from 0 to 1 (50% vol in the above example).
It uses the 'System Stream' to send the sound, this stream is the stream for system sounds. The system volume in settings will set the max, so if you pass a value of 1 (100%) but the system volume is set at 1 (on a scale of 1 to 7) then the output sound level will be approx 14%.
There 9 different sound effects defined in the API,
Standard
Click
NavUp
NavDown
NavLeft
NavRight
Return
SpaceBar
Delete
On my phone (HTC Desire) the 4 Nav sounds and the Click sounds are the same.
Attached is a small demo program.
 

Attachments

  • esClickSoundGenLibrary.zip
    2.3 KB · Views: 699
  • ClickSoundDemo.zip
    7.1 KB · Views: 557

Djembefola

Active Member
Licensed User
Longtime User
Thank you for sharing.

I have tested your library on my device:
a single call of any ...fx function triggers the sound often twice (= two click sounds with a short delay of some milliseconds)

i have used the debug window with a counter to make sure that the double sound is not caused by my shaky fingers.
 

lagore

Active Member
Licensed User
Longtime User
Hi thanks for the feedback, I will have a look at that.
 

CapReed

Member
Licensed User
Longtime User
It's Perfect! Very simple and easy.

Thank you for you efforts! :icon_clap:
 

RonSens

Member
Licensed User
Longtime User
easy and working very smoothly. Is it possible to create new sounds?
Thanks for the great library!
 

hookshy

Well-Known Member
Licensed User
Longtime User
volume of this this library does not work on all devices
keyklickfx(volume) it supposed to modify click volume from 0 to 1
If you use keyclickfx to enable click sound and let user disable the click sound then user on some devices will interpret this as bug because
his device already clicks by default when pushing buttons .
I tested it on Samsung s4Duo and got report from other users as well .
I have still lot of questions on this matter maybe there are some answers somewhere and I did not found it yet .
 
Top