Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog28
-rw-r--r--Makefile.am2
-rw-r--r--boards/music/background/Brahms_Johannes-String_Quartet_C_minor_Op_51_mvmt_4.oggbin4998997 -> 0 bytes
-rw-r--r--boards/sounds/eu/alphabet/a.oggbin19295 -> 0 bytes
-rw-r--r--src/gcompris/bar.c28
-rw-r--r--src/gcompris/bonus.c22
-rw-r--r--src/gcompris/file_selector.c18
-rw-r--r--src/gcompris/gameutil.c42
-rw-r--r--src/gcompris/gcompris.c11
-rw-r--r--src/gcompris/skin.h1
-rw-r--r--src/gcompris/soundutil.c39
-rw-r--r--src/gcompris/soundutil.h4
12 files changed, 122 insertions, 73 deletions
diff --git a/ChangeLog b/ChangeLog
index b10e620..688276c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2006-05-05 Bruno coudoin <bruno.coudoin@free.fr>
+
+ Removed unused sounds (10.ogg and above) from the install because
+ we don't use them.
+ Removed Brahms because it's huge and of bad quality.
+
+ Started the removal of assetml. Now in the core, all sounds are assetml free.
+ Improved the function gcompris_find_absolute_filename() to support a $LOCALE
+ tag in a string. It will be replaced by the current locale when found.
+
+ Next step is to remove assetml from the activity and dataset, then from the API.
+
+ * Makefile.am:
+ * boards/music/background/Brahms_Johannes-String_Quartet_C_minor_Op
+ _51_mvmt_4.ogg:
+ * boards/sounds/eu/alphabet/a.ogg:
+ * src/gcompris/bar.c: (bar_play_sound), (item_event_bar):
+ * src/gcompris/bonus.c: (gcompris_display_bonus):
+ * src/gcompris/file_selector.c: (parseMime),
+ (load_mime_type_from_file):
+ * src/gcompris/gameutil.c: (gcompris_find_absolute_filename):
+ * src/gcompris/gcompris.c: (gcompris_init):
+ * src/gcompris/skin.h:
+ * src/gcompris/soundutil.c: (thread_play_ogg),
+ (gcompris_play_ogg_cb), (gcompris_play_ogg),
+ (gcompris_sound_class_init):
+ * src/gcompris/soundutil.h:
+
2006-04-29 bruno
Added mandatory_sound_file to have missing sound icon displayed
diff --git a/Makefile.am b/Makefile.am
index 074ba51..683dece 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,7 +36,7 @@ install-data-local:
@$(NORMAL_INSTALL)
if test -d $(srcdir)/$(PACKAGE_DATA_DIR); then \
$(mkinstalldirs) $(DESTDIR)/$(pkgdatadir)/$(PACKAGE_DATA_DIR); \
- cd $(srcdir)/$(PACKAGE_DATA_DIR) ; tar cf - --exclude "Makefile.in" --exclude "*.in" --exclude "*~" --exclude "Makefile" --exclude "Makefile.am" --exclude CVS --exclude .xvpics --exclude "*.assetml" * | ( cd $(DESTDIR)/$(pkgdatadir)/$(PACKAGE_DATA_DIR) ; tar xf -) ; cd .. ; \
+ cd $(srcdir)/$(PACKAGE_DATA_DIR) ; tar cf - --exclude "Makefile.in" --exclude "*.in" --exclude "*~" --exclude "Makefile" --exclude "Makefile.am" --exclude CVS --exclude .xvpics --exclude "*.assetml" --exclude "[12]?.ogg" --exclude "Brahms*.ogg" * | ( cd $(DESTDIR)/$(pkgdatadir)/$(PACKAGE_DATA_DIR) ; tar xf -) ; cd .. ; \
fi
dist-hook:
diff --git a/boards/music/background/Brahms_Johannes-String_Quartet_C_minor_Op_51_mvmt_4.ogg b/boards/music/background/Brahms_Johannes-String_Quartet_C_minor_Op_51_mvmt_4.ogg
deleted file mode 100644
index 2c4bbb7..0000000
--- a/boards/music/background/Brahms_Johannes-String_Quartet_C_minor_Op_51_mvmt_4.ogg
+++ /dev/null
Binary files differ
diff --git a/boards/sounds/eu/alphabet/a.ogg b/boards/sounds/eu/alphabet/a.ogg
deleted file mode 100644
index 6472208..0000000
--- a/boards/sounds/eu/alphabet/a.ogg
+++ /dev/null
Binary files differ
diff --git a/src/gcompris/bar.c b/src/gcompris/bar.c
index 03bddfd..e09bc28 100644
--- a/src/gcompris/bar.c
+++ b/src/gcompris/bar.c
@@ -1,6 +1,6 @@
/* gcompris - bar.c
*
- * Time-stamp: <2006/03/12 03:02:12 bruno>
+ * Time-stamp: <2006/05/05 00:48:26 bruno>
*
* Copyright (C) 2000-2003 Bruno Coudoin
*
@@ -447,17 +447,14 @@ static void update_exit_button()
static gint bar_play_sound (gchar *sound)
{
int policy = getSoundPolicy();
- gchar *str1;
- gchar *str2;
+ gchar *str;
setSoundPolicy(PLAY_ONLY_IF_IDLE);
- str1 = g_strdup_printf("%s%s", sound, ".ogg");
- str2 = gcompris_get_asset_file("gcompris misc", NULL, "audio/x-ogg", str1);
+ str = g_strdup_printf("sounds/$LOCALE/misc/%s.ogg", sound);
- gcompris_play_ogg( str2, NULL);
+ gcompris_play_ogg(str, NULL);
- g_free(str1);
- g_free(str2);
+ g_free(str);
setSoundPolicy(policy);
sound_play_id = 0;
@@ -508,9 +505,6 @@ item_event_bar(GnomeCanvasItem *item, GdkEvent *event, gchar *data)
else if(!strcmp((char *)data, "level"))
{
gint tmp = current_level;
- gchar *current_level_str;
- gchar *str_level;
- gchar *str_number;
current_level++;
if(current_level>gcomprisBoard->maxlevel)
@@ -518,16 +512,16 @@ item_event_bar(GnomeCanvasItem *item, GdkEvent *event, gchar *data)
if(tmp!=current_level)
{
- char *number_str = g_strdup_printf("%d", current_level);
- current_level_str = gcompris_alphabet_sound(number_str);
+ gchar *str_number;
+
+ gchar *number_str = g_strdup_printf("%d", current_level);
+ gchar *current_level_str = gcompris_alphabet_sound(number_str);
g_free(number_str);
- str_level = gcompris_get_asset_file("gcompris misc", NULL, "audio/x-ogg", "level.ogg");
- str_number = gcompris_get_asset_file("gcompris alphabet", NULL, "audio/x-ogg", current_level_str);
+ str_number = g_strdup_printf("sounds/$LOCALE/alphabet/%s", current_level_str);
- gcompris_play_ogg(str_level, str_number, NULL);
+ gcompris_play_ogg("sounds/$LOCALE/misc/level.ogg", str_number, NULL);
- g_free(str_level);
g_free(str_number);
g_free(current_level_str);
}
diff --git a/src/gcompris/bonus.c b/src/gcompris/bonus.c
index 7293752..4bef684 100644
--- a/src/gcompris/bonus.c
+++ b/src/gcompris/bonus.c
@@ -41,14 +41,14 @@ static int left_door_limit = 0;
// List of sounds to use for greetings
static gchar *greetingsList[] =
{
- "congratulation.ogg",
- "great.ogg",
- "good.ogg",
- "awesome.ogg",
- "fantastic.ogg",
- "waytogo.ogg",
- "super.ogg",
- "perfect.ogg"
+ "sounds/$LOCALE/misc/congratulation.ogg",
+ "sounds/$LOCALE/misc/great.ogg",
+ "sounds/$LOCALE/misc/good.ogg",
+ "sounds/$LOCALE/misc/awesome.ogg",
+ "sounds/$LOCALE/misc/fantastic.ogg",
+ "sounds/$LOCALE/misc/waytogo.ogg",
+ "sounds/$LOCALE/misc/super.ogg",
+ "sounds/$LOCALE/misc/perfect.ogg"
};
#define NUMBER_OF_GREETINGS 8
@@ -207,11 +207,7 @@ void gcompris_display_bonus(BonusStatusList gamewon, BonusList bonus_id)
bonus_display_running = TRUE;
if(gamewon == BOARD_WIN || gamewon == BOARD_DRAW) {
- gchar *str = gcompris_get_asset_file("gcompris misc", NULL,
- "audio/x-ogg",
- greetingsList[RAND(0, NUMBER_OF_GREETINGS-1)]);
- gcompris_play_ogg(str, NULL);
- g_free(str);
+ gcompris_play_ogg(greetingsList[RAND(0, NUMBER_OF_GREETINGS-1)], NULL);
} else {
gcompris_play_ogg ("crash", NULL);
}
diff --git a/src/gcompris/file_selector.c b/src/gcompris/file_selector.c
index eb1efbf..d16c514 100644
--- a/src/gcompris/file_selector.c
+++ b/src/gcompris/file_selector.c
@@ -1,6 +1,6 @@
/* gcompris - file_selector.c
*
- * Time-stamp: <2005/11/12 19:00:49 bruno>
+ * Time-stamp: <2006/05/05 00:01:26 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
@@ -813,16 +813,16 @@ void parseMime (xmlDocPtr doc, xmlNodePtr xmlnode) {
GcomprisMimeType *gcomprisMime = g_malloc0 (sizeof (GcomprisMimeType));
- gcomprisMime->mimetype = xmlGetProp(xmlnode,"mimetype");
- gcomprisMime->extension = xmlGetProp(xmlnode,"extension");
- gcomprisMime->icon = xmlGetProp(xmlnode,"icon");
+ gcomprisMime->mimetype = (gchar *)xmlGetProp(xmlnode, BAD_CAST "mimetype");
+ gcomprisMime->extension = (gchar *)xmlGetProp(xmlnode, BAD_CAST "extension");
+ gcomprisMime->icon = (gchar *)xmlGetProp(xmlnode, BAD_CAST "icon");
gcomprisMime->description = NULL;
/* get the help user credit of the board */
xmlnode = xmlnode->xmlChildrenNode;
while (xmlnode != NULL) {
- gchar *lang = xmlGetProp(xmlnode,"lang");
- if (!strcmp(xmlnode->name, "description")
+ gchar *lang = (gchar *)xmlGetProp(xmlnode, BAD_CAST "lang");
+ if (!strcmp((char *)xmlnode->name, "description")
&& (lang==NULL ||
!strcmp(lang, gcompris_get_locale())
|| !strncmp(lang, gcompris_get_locale(), 2)))
@@ -830,8 +830,8 @@ void parseMime (xmlDocPtr doc, xmlNodePtr xmlnode) {
if(gcomprisMime->description)
g_free(gcomprisMime->description);
- gcomprisMime->description = xmlNodeListGetString(doc,
- xmlnode->xmlChildrenNode, 1);
+ gcomprisMime->description = (gchar *)xmlNodeListGetString(doc,
+ xmlnode->xmlChildrenNode, 1);
}
xmlnode = xmlnode->next;
}
@@ -906,7 +906,7 @@ gboolean load_mime_type_from_file(gchar *fname)
/* if it doesn't have a name */
!doc->children->name ||
/* if it isn't the good node */
- g_strcasecmp(doc->children->name,"MimeTypeRoot")!=0) {
+ g_strcasecmp((gchar *)doc->children->name,"MimeTypeRoot")!=0) {
xmlFreeDoc(doc);
return FALSE;
}
diff --git a/src/gcompris/gameutil.c b/src/gcompris/gameutil.c
index ee61019..7df5b2c 100644
--- a/src/gcompris/gameutil.c
+++ b/src/gcompris/gameutil.c
@@ -1,6 +1,6 @@
/* gcompris - gameutil.c
*
- * Time-stamp: <2006/04/04 00:21:44 bruno>
+ * Time-stamp: <2006/05/05 00:53:26 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
@@ -1323,6 +1323,9 @@ gchar *g_utf8_strndup(gchar* utf8text, gint n)
/** \brief search a given relative file in all gcompris dir it could be found
*
+ * If filename contains $LOCALE, it will be first replaced by the current long locale
+ * and if not found the short locale name.
+ *
* \return NULL or a new gchar* with the absolute_filename of the given filename
*
*/
@@ -1356,8 +1359,43 @@ gchar *gcompris_find_absolute_filename(gchar *filename)
while (dir_to_search[i])
{
+ gchar **tmp;
g_free(absolute_filename);
- absolute_filename = g_strdup_printf("%s/%s", dir_to_search[i], filename);
+
+ /* Check there is a $LOCALE to replace */
+ if((tmp = g_strsplit(filename, "$LOCALE", -1)))
+ {
+ gchar locale[6];
+ gchar *filename2;
+
+ /* First try with the long locale */
+ g_strlcpy(locale, gcompris_get_locale(), sizeof(locale));
+ filename2 = g_strjoinv(locale, tmp);
+ absolute_filename = g_strdup_printf("%s/%s", dir_to_search[i], filename2);
+ g_free(filename2);
+ g_warning(">>>> trying %s\n", absolute_filename);
+ if(g_file_test (absolute_filename, G_FILE_TEST_IS_REGULAR))
+ {
+ g_strfreev(tmp);
+ goto FOUND;
+ }
+
+ /* Try the short locale */
+ locale[2] = '\0';
+ filename2 = g_strjoinv(locale, tmp);
+ g_strfreev(tmp);
+ absolute_filename = g_strdup_printf("%s/%s", dir_to_search[i], filename2);
+ g_free(filename2);
+ g_warning(">>>> tryiing %s\n", absolute_filename);
+ if(g_file_test (absolute_filename, G_FILE_TEST_IS_REGULAR))
+ goto FOUND;
+
+ }
+ else
+ {
+ absolute_filename = g_strdup_printf("%s/%s", dir_to_search[i], filename);
+ }
+
i++;
if(g_file_test (absolute_filename, G_FILE_TEST_IS_REGULAR))
goto FOUND;
diff --git a/src/gcompris/gcompris.c b/src/gcompris/gcompris.c
index a77f96d..14f6a1d 100644
--- a/src/gcompris/gcompris.c
+++ b/src/gcompris/gcompris.c
@@ -1119,7 +1119,6 @@ gcompris_init (int argc, char *argv[])
{
poptContext pctx;
int popt_option;
- gchar *str;
/* First, Remove the gnome crash dialog because it locks the user when in full screen */
signal(SIGSEGV, gcompris_terminate);
@@ -1444,16 +1443,10 @@ gcompris_init (int argc, char *argv[])
gtk_widget_show_all (window);
- str = gcompris_get_asset_file("gcompris misc", NULL, "audio/x-ogg", "welcome.ogg");
-
if (properties->music)
- {
- gcompris_play_ogg("intro", str, NULL);
- }
+ gcompris_play_ogg("intro", "sounds/$LOCALE/misc/welcome.ogg", NULL);
else
- gcompris_play_ogg(str, NULL);
-
- g_free(str);
+ gcompris_play_ogg("sounds/$LOCALE/misc/welcome.ogg", NULL);
gtk_main ();
return 0;
diff --git a/src/gcompris/skin.h b/src/gcompris/skin.h
index db437a8..c912266 100644
--- a/src/gcompris/skin.h
+++ b/src/gcompris/skin.h
@@ -54,6 +54,7 @@ void gcompris_skin_free (void);
guint32 gcompris_skin_get_color_default(gchar* id, guint32 def);
void gcompris_skin_get_gdkcolor_default(gchar* id, guint32 def, GdkColor *gdkcolor);
gchar* gcompris_skin_get_font_default(gchar* id, gchar* def);
+guint32 gcompris_skin_get_number_default(gchar* id, guint32 def);
#define gcompris_skin_get_gdkcolor(id, gdkcolor) gcompris_skin_get_gdkcolor_default(id, 0x0D0DFA00, gdkcolor)
#define gcompris_skin_get_color(id) gcompris_skin_get_color_default(id, 0x0D0DFA00)
diff --git a/src/gcompris/soundutil.c b/src/gcompris/soundutil.c
index e9dd610..9c8fcc3 100644
--- a/src/gcompris/soundutil.c
+++ b/src/gcompris/soundutil.c
@@ -271,33 +271,27 @@ static void* thread_play_ogg (char *file)
if (!g_file_test (file, G_FILE_TEST_IS_REGULAR)) {
gchar *relative_filename;
- char locale[3];
- strncpy( locale, gcompris_get_locale(), 2 );
- locale[2] = 0; // because strncpy does not put a '\0' at the end of the string
- relative_filename = g_strdup_printf("sounds/%s/%s.ogg", locale, file);
+
+ relative_filename = g_strdup_printf("music/%s.ogg", file);
tmpstr = gcompris_find_absolute_filename(relative_filename);
g_free(relative_filename);
if (!tmpstr){
- relative_filename = g_strdup_printf("music/%s.ogg", file);
+ /* Try to find a sound file that does not need to be localized
+ (ie directly in root /sounds directory) */
+ relative_filename = g_strdup_printf("sounds/%s.ogg", file);
tmpstr = gcompris_find_absolute_filename(relative_filename);
g_free(relative_filename);
if (!tmpstr){
- /* Try to find a sound file that does not need to be localized
- (ie directly in root /sounds directory) */
- relative_filename = g_strdup_printf("sounds/%s.ogg", file);
- tmpstr = gcompris_find_absolute_filename(relative_filename);
- g_free(relative_filename);
+ tmpstr = gcompris_find_absolute_filename(file);
if (!tmpstr){
- tmpstr = gcompris_find_absolute_filename(file);
- if (!tmpstr){
g_warning("Can't find sound %s", file);
if (sound_callbacks)
g_hash_table_remove (sound_callbacks, file);
return NULL;
- }
}
}
}
+
g_free( file );
file = tmpstr;
}
@@ -343,7 +337,7 @@ char* get_next_sound_to_play( )
* gcompris_play_ogg function to process the sounds.
======================================================================*/
-void gcompris_play_ogg_cb(gchar *file, GcomprisSoundCallback cb)
+void gcompris_play_ogg_cb(const gchar *file, GcomprisSoundCallback cb)
{
g_assert ( cb != NULL);
@@ -359,7 +353,7 @@ void gcompris_play_ogg_cb(gchar *file, GcomprisSoundCallback cb)
/* i suppose there will not be two call of that function with same sound file before sound is played */
g_hash_table_replace (sound_callbacks,
- intern_file,
+ (gpointer)intern_file,
cb);
gcompris_play_ogg(intern_file, NULL);
}
@@ -369,7 +363,7 @@ void gcompris_play_ogg_cb(gchar *file, GcomprisSoundCallback cb)
* This function wraps the var args into a GList and call the
* gcompris_play_ogg_list function to process the sounds.
======================================================================*/
-void gcompris_play_ogg(char *sound, ...)
+void gcompris_play_ogg(const gchar *sound, ...)
{
va_list ap;
char* tmp = NULL;
@@ -378,14 +372,14 @@ void gcompris_play_ogg(char *sound, ...)
if(!sound)
return;
- list = g_list_append(list, sound);
+ list = g_list_append(list, (gpointer)sound);
g_warning("Adding %s in the play list queue\n", sound);
va_start( ap, sound);
while( (tmp = va_arg (ap, char *)))
{
- list = g_list_append(list, tmp);
+ list = g_list_append(list, (gpointer)tmp);
}
va_end(ap);
@@ -432,7 +426,13 @@ void gcompris_play_ogg_list( GList* files )
}
-/* get alphabet sound file name from gunichar */
+/** return a string representing a letter or number audio file
+ * get alphabet sound file name from gunichar
+ *
+ * the returned sound has the suffix .ogg
+ *
+ * \return a newly allocated string of the form U0033.ogg
+ */
gchar *gcompris_alphabet_sound(gchar *chars)
{
@@ -514,7 +514,6 @@ static void
gcompris_sound_class_init (gpointer g_class,
gpointer g_class_data)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
GcomprisSoundClass *klass = GCOMPRIS_SOUND_CLASS (g_class);
klass->sound_played = default_sound_played_signal_handler;
diff --git a/src/gcompris/soundutil.h b/src/gcompris/soundutil.h
index f8b924f..fbb384b 100644
--- a/src/gcompris/soundutil.h
+++ b/src/gcompris/soundutil.h
@@ -35,8 +35,8 @@ typedef enum
typedef void (*GcomprisSoundCallback) (gchar *);
-void gcompris_play_ogg(char *, ...);
-void gcompris_play_ogg_cb(char *, GcomprisSoundCallback);
+void gcompris_play_ogg(const gchar *, ...);
+void gcompris_play_ogg_cb(const gchar *, GcomprisSoundCallback);
void gcompris_play_ogg_list( GList* files );
void setSoundPolicy(int);
int getSoundPolicy(void);