8 #include "debug_print.h"
11 static pthread_mutex_t mutex_conf = PTHREAD_MUTEX_INITIALIZER;
14 /**** 記録周波数 ***************************************************
19 void conf_freq_set(int f)
21 pthread_mutex_lock(&mutex_conf);
23 pthread_mutex_unlock(&mutex_conf);
25 int conf_freq_get(void)
28 pthread_mutex_lock(&mutex_conf);
30 pthread_mutex_unlock(&mutex_conf);
34 /**** Gain ***************************************************
37 0=1/8, 1=1/4, 2=1/2, 3=1, 4=2, 5=4
38 6=8, 7=16, 8=32, 9=64, 10=128
42 void conf_gain_set(int f)
44 pthread_mutex_lock(&mutex_conf);
46 pthread_mutex_unlock(&mutex_conf);
48 int conf_gain_get(void)
51 pthread_mutex_lock(&mutex_conf);
53 pthread_mutex_unlock(&mutex_conf);
58 /**** 設定ファイル *******************************************
63 static void trims_space(char *name)
81 if (name0 != name) memmove(name0, name, len);
88 static void trime_space(char *name)
97 for(i = len - 1; i >= 0; i--) {
108 static void trim_space(char *name)
110 if (name == NULL) return;
117 static void trim_crlf(char *name)
123 if (name == NULL) return;
127 for(i = 0; i < len; i++) {
128 if (*src != 0x0d && *src != 0x0a) {
151 fp = fopen(CONF_FILE, "rt");
153 syslog(LOG_ERR, "conf_read(): conf file not found. %s", CONF_FILE);
157 syslog(LOG_INFO, "conf_read():");
158 while(fgets(buf, sizeof(buf), fp)) {
165 if (sscanf(buf, "freq = %d", &f) == 1) {
167 syslog(LOG_INFO, "freq=%d", conf_freq_get());
170 if (sscanf(buf, "gain = %d", &f) == 1) {
172 syslog(LOG_INFO, "gain=%d", conf_gain_get());