Go to the source code of this file.
Classes | |
struct | wavFile_t |
Defines | |
#define | AUDIO_DEVICE "/dev/dsp" |
#define | FILENAME_KEY_CLICK (DATA_DIR "/clicked_key.wav") |
#define | FILENAME_KEY_CLICK_DISCARDED (DATA_DIR "/clicked_key_discarded.wav") |
#define | FILENAME_PEN_CLICK (DATA_DIR "/clicked_pen.wav") |
Enumerations | |
enum | playSoundType_e { playClickedKey = 0, playClickedKeyDiscarded, playClickedPen, playUndefined } |
Functions | |
gboolean | click_init () |
void | handle_sound_settings_changed (int volume) |
void | click_key () |
void | click_key_discard () |
void | click_pen () |
Generate keys-click on request
Definition in file click.h.
#define FILENAME_KEY_CLICK_DISCARDED (DATA_DIR "/clicked_key_discarded.wav") |
enum playSoundType_e |
Definition at line 40 of file click.h.
00041 { 00042 playClickedKey = 0, 00043 playClickedKeyDiscarded, 00044 playClickedPen, 00045 // playClickedPenDiscarded, 00046 playUndefined 00047 } playSoundType_e;
gboolean click_init | ( | ) |
Definition at line 150 of file click.c.
00151 { 00152 int err; 00153 pthread_t click_tid; 00154 regUserSetting_t *theUserSetting = NULL; 00155 00156 // Retrieve user setting from registry 00157 // Setup the mixer volumes according to the users wishes 00158 theUserSetting = erRegGetUserSetting(); 00159 if (theUserSetting) 00160 { 00161 g_volume_settings = theUserSetting->volume; 00162 erRegFreeUserSetting (theUserSetting); 00163 } 00164 else 00165 { 00166 // default is on 00167 g_volume_settings = 75; 00168 } 00169 00170 // Turn on/off the audio device according to the settings 00171 enable_audio_device(g_volume_settings>0 ? TRUE : FALSE); 00172 00173 if (g_volume_settings > 0) 00174 { 00175 // The sound is on, set the volume 00176 set_volume(g_volume_settings); 00177 } 00178 00179 // Second, read the waveforms 00180 if (!read_waveforms()) 00181 { 00182 CL_ERRORPRINTF("Error reading waveforms."); 00183 return FALSE; 00184 } 00185 00186 // Initialize mutex 00187 err = pthread_mutex_init (&g_click_mutex, NULL); 00188 if (err != 0) 00189 { 00190 CL_ERRORPRINTF ("Mutex init error [%d]", err); 00191 destroy_waveforms(); 00192 return FALSE; 00193 } 00194 00195 // start click-thread 00196 err = pthread_create (&click_tid, NULL, click_thread, NULL); 00197 if (err != 0) 00198 { 00199 CL_ERRORPRINTF ("start click-thread error [%d]", err); 00200 destroy_waveforms(); 00201 return FALSE; 00202 } 00203 00204 // get here, success 00205 return TRUE; 00206 }
void click_key | ( | ) |
play click key sound
Definition at line 245 of file click.c.
00246 { 00247 play_sound(playClickedKey); 00248 }
void click_key_discard | ( | ) |
play click key discarded sound
Definition at line 250 of file click.c.
00251 { 00252 play_sound(playClickedKeyDiscarded); 00253 }
void click_pen | ( | ) |
play click pen sound
Definition at line 255 of file click.c.
00256 { 00257 play_sound(playClickedPen); 00258 }
void handle_sound_settings_changed | ( | int | volume | ) |
Definition at line 208 of file click.c.
00209 { 00210 g_volume_settings = volume; 00211 00212 // Turn on/off the audio device according to the settings 00213 enable_audio_device(g_volume_settings>0 ? TRUE : FALSE); 00214 00215 if (g_volume_settings > 0) 00216 { 00217 // The sound is on, set the volume 00218 set_volume(g_volume_settings); 00219 } 00220 }