summaryrefslogtreecommitdiff
path: root/apps/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/misc.c')
-rw-r--r--apps/misc.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/apps/misc.c b/apps/misc.c
index dfee05fb5a..1800342a50 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -1037,3 +1037,51 @@ enum current_activity get_current_activity(void)
1037 return current_activity[current_activity_top?current_activity_top-1:0]; 1037 return current_activity[current_activity_top?current_activity_top-1:0];
1038} 1038}
1039 1039
1040#if CONFIG_CODEC == SWCODEC
1041/* Play a standard sound */
1042void system_sound_play(enum system_sound sound)
1043{
1044 static const struct beep_params
1045 {
1046 int *setting;
1047 unsigned short frequency;
1048 unsigned short duration;
1049 unsigned short amplitude;
1050 } beep_params[] =
1051 {
1052 [SOUND_KEYCLICK] =
1053 { &global_settings.keyclick,
1054 4000, KEYCLICK_DURATION, 2500 },
1055 [SOUND_TRACK_SKIP] =
1056 { &global_settings.beep,
1057 2000, 100, 2500 },
1058 [SOUND_TRACK_NO_MORE] =
1059 { &global_settings.beep,
1060 1000, 100, 1500 },
1061 };
1062
1063 const struct beep_params *params = &beep_params[sound];
1064
1065 if (*params->setting)
1066 {
1067 beep_play(params->frequency, params->duration,
1068 params->amplitude * *params->setting);
1069 }
1070}
1071
1072/* Produce keyclick based upon button and global settings */
1073void keyclick_click(int button)
1074{
1075 /* Settings filters */
1076 if (global_settings.keyclick &&
1077 (global_settings.keyclick_repeats || !(button & BUTTON_REPEAT)))
1078 {
1079 /* Button filters */
1080 if (button != BUTTON_NONE && !(button & BUTTON_REL)
1081 && !(button & (SYS_EVENT|BUTTON_MULTIMEDIA)) )
1082 {
1083 system_sound_play(SOUND_KEYCLICK);
1084 }
1085 }
1086}
1087#endif /* CONFIG_CODEC == SWCODEC */