[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/7] move module_audio_init from each module to the module_util.c
From: |
Andrei Kholodnyi |
Subject: |
[PATCH 1/7] move module_audio_init from each module to the module_util.c |
Date: |
Sun, 28 Nov 2010 19:51:22 +0100 |
rename module_audio_spd_init to module_audio_init and
remove corresponding functions from synths.
There is no need to init audio specific for each module
always return status_info from module_audio_init
free status_info
---
src/modules/cicero.c | 9 ---------
src/modules/dummy.c | 6 ------
src/modules/espeak.c | 8 --------
src/modules/festival.c | 5 -----
src/modules/flite.c | 8 --------
src/modules/generic.c | 8 --------
src/modules/ibmtts.c | 8 --------
src/modules/ivona.c | 7 -------
src/modules/module_utils.c | 8 +++++---
src/modules/module_utils.h | 2 --
src/modules/pico.c | 5 -----
11 files changed, 5 insertions(+), 69 deletions(-)
diff --git a/src/modules/cicero.c b/src/modules/cicero.c
index 74f38c3..e188fbc 100644
--- a/src/modules/cicero.c
+++ b/src/modules/cicero.c
@@ -226,15 +226,6 @@ module_init(char **status_info)
return 0;
}
-
-int
-module_audio_init(char **status_info){
- /* The following statement has no effect and so was commented out */
- //status_info == NULL;
- return 0;
-}
-
-
SPDVoice**
module_list_voices(void)
{
diff --git a/src/modules/dummy.c b/src/modules/dummy.c
index 7bfa6a8..47fb3d9 100644
--- a/src/modules/dummy.c
+++ b/src/modules/dummy.c
@@ -92,12 +92,6 @@ module_init(char **status_info)
return 0;
}
-int
-module_audio_init(char **status_info){
- status_info = NULL;
- return 0;
-}
-
SPDVoice**
module_list_voices(void)
{
diff --git a/src/modules/espeak.c b/src/modules/espeak.c
index ecc4d69..0253648 100644
--- a/src/modules/espeak.c
+++ b/src/modules/espeak.c
@@ -310,14 +310,6 @@ module_init(char **status_info)
return OK;
}
-
-int
-module_audio_init(char **status_info){
- DBG("Opening audio");
- return module_audio_init_spd(status_info);
-}
-
-
SPDVoice**
module_list_voices(void)
{
diff --git a/src/modules/festival.c b/src/modules/festival.c
index c754925..80bdeb8 100644
--- a/src/modules/festival.c
+++ b/src/modules/festival.c
@@ -310,11 +310,6 @@ module_init(char **status_info)
#undef ABORT
-int
-module_audio_init(char **status_info){
- return module_audio_init_spd(status_info);
-}
-
SPDVoice**
module_list_voices(void)
{
diff --git a/src/modules/flite.c b/src/modules/flite.c
index d9f70b0..f196cff 100644
--- a/src/modules/flite.c
+++ b/src/modules/flite.c
@@ -151,14 +151,6 @@ module_init(char **status_info)
}
#undef ABORT
-
-int
-module_audio_init(char **status_info){
- DBG("Opening audio");
- return module_audio_init_spd(status_info);
-}
-
-
SPDVoice**
module_list_voices(void)
{
diff --git a/src/modules/generic.c b/src/modules/generic.c
index 6818d79..0a3f7a8 100644
--- a/src/modules/generic.c
+++ b/src/modules/generic.c
@@ -171,14 +171,6 @@ module_init(char **status_info)
return 0;
}
-int
-module_audio_init(char **status_info){
- *status_info = NULL;
- DBG("Opening audio");
- return module_audio_init_spd(status_info);
-}
-
-
SPDVoice**
module_list_voices(void)
{
diff --git a/src/modules/ibmtts.c b/src/modules/ibmtts.c
index 7fe5688..5041d86 100644
--- a/src/modules/ibmtts.c
+++ b/src/modules/ibmtts.c
@@ -530,14 +530,6 @@ module_init(char **status_info)
return OK;
}
-
-int
-module_audio_init(char **status_info){
- DBG("Opening audio");
- return module_audio_init_spd(status_info);
-}
-
-
SPDVoice**
module_list_voices(void)
{
diff --git a/src/modules/ivona.c b/src/modules/ivona.c
index a43e359..722bd39 100644
--- a/src/modules/ivona.c
+++ b/src/modules/ivona.c
@@ -167,13 +167,6 @@ module_init(char **status_info)
}
#undef ABORT
-
-int
-module_audio_init(char **status_info){
- DBG("Opening audio");
- return module_audio_init_spd(status_info);
-}
-
static SPDVoice voice_jacek;
static SPDVoice *voice_ivona[]={&voice_jacek,NULL};
SPDVoice**
diff --git a/src/modules/module_utils.c b/src/modules/module_utils.c
index 6aa7568..652b123 100644
--- a/src/modules/module_utils.c
+++ b/src/modules/module_utils.c
@@ -248,7 +248,7 @@ do_audio(void)
int ret;
size_t n;
int err = 0; /* Error status */
- char *status;
+ char *status = NULL;
char *msg;
printf("207 OK RECEIVING AUDIO SETTINGS\n");
@@ -288,7 +288,8 @@ do_audio(void)
msg = g_strdup_printf("203 OK AUDIO INITIALIZED");
else
msg = g_strdup_printf("300-%s\n300 UNKNOWN ERROR", status);
-
+
+ g_free(status);
return msg;
}
@@ -1030,7 +1031,7 @@ module_get_ht_option(GHashTable *hash_table, const char
*key)
}
int
-module_audio_init_spd(char **status_info)
+module_audio_init(char **status_info)
{
char *error=0;
gchar **outputs;
@@ -1049,6 +1050,7 @@ module_audio_init_spd(char **status_info)
if (module_audio_id) {
DBG("Using %s audio output method", outputs[i]);
g_strfreev (outputs);
+ *status_info = g_strdup("audio initialized successfully.");
return 0;
}
i++;
diff --git a/src/modules/module_utils.h b/src/modules/module_utils.h
index bb2b2be..c790a4a 100644
--- a/src/modules/module_utils.h
+++ b/src/modules/module_utils.h
@@ -123,7 +123,6 @@ int module_num_dc_options;
int module_load (void);
int module_init (char **status_info);
-int module_audio_init_spd (char **status_info);
SPDVoice** module_list_voices(void);
int module_speak (char *data, size_t bytes, SPDMessageType msgtype);
int module_stop (void);
@@ -407,7 +406,6 @@ void module_report_event_pause(void);
extern pthread_mutex_t module_stdout_mutex;
int module_utils_init(void);
-int module_audio_init_spd(char **status_info);
int module_audio_init(char **status_info);
/* Prototypes from module_utils_addvoice.c */
diff --git a/src/modules/pico.c b/src/modules/pico.c
index 8164f47..b3b4cbf 100644
--- a/src/modules/pico.c
+++ b/src/modules/pico.c
@@ -445,11 +445,6 @@ int module_init(char **status_info)
return 0;
}
-int module_audio_init(char **status_info)
-{
- return module_audio_init_spd(status_info);
-}
-
SPDVoice **module_list_voices(void)
{
return pico_voices_list;
--
1.6.0.4
- [PATCH 1/7] move module_audio_init from each module to the module_util.c,
Andrei Kholodnyi <=
[PATCH 1/7] move module_audio_init from each module to the module_util.c, Trevor Saunders, 2010/11/28