Back to index

gcompris  8.2.2
soundutil.h
Go to the documentation of this file.
00001 /* gcompris - gameutil.h
00002  *
00003  * Time-stamp: <2000/07/16 00:32:26 bruno>
00004  *
00005  * Copyright (C) 2000 Bruno Coudoin
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020  */
00021 #ifndef SOUNDUTIL_H
00022 #define SOUNDUTIL_H
00023 
00024 #include <stdio.h>
00025 #include "gcompris.h"
00026 
00027 #define MAX_QUEUE_LENGTH 5
00028 #define MAX_SOUND_FILES 20
00029 
00030 typedef enum
00031 {
00032   PLAY_ONLY_IF_IDLE         = 0,
00033   PLAY_AFTER_CURRENT        = 1,
00034   PLAY_AND_INTERRUPT        = 2,
00035 } SoundPolicy;
00036 
00037 typedef void (*GcomprisSoundCallback) (gchar *);
00038 
00039 void    gc_sound_play_ogg(const gchar *, ...);
00040 void    gc_sound_play_ogg_cb(const gchar *, GcomprisSoundCallback);
00041 void    gc_sound_play_ogg_list( GList* files );
00042 void    gc_sound_policy_set(int);
00043 int     gc_sound_policy_get(void);
00044 void    gc_sound_init(void);
00045 void    gc_sound_reopen(void);
00046 void    gc_sound_close(void);
00047 void    gc_sound_pause(void);
00048 void    gc_sound_resume(void);
00049 
00050 int     decode_ogg_file(char *infile);
00051 void    display_ao_devices();
00052 
00053 /*
00054  * SDL PLAYER
00055  */
00056 int     sdlplayer_init();
00057 void    sdlplayer_close();
00058 void    sdlplayer_reopen();
00059 
00060 int     sdlplayer_music(char *filename, int volume);
00061 void    sdlplayer_halt_music();
00062 void    sdlplayer_pause_music();
00063 void    sdlplayer_resume_music();
00064 
00065 void    sdlplayer_halt_fx();
00066 void    sdlplayer_resume_fx();
00067 int     sdlplayer_fx(char *filename, int volume);
00068 
00069 gchar *gc_sound_alphabet(gchar *chars);
00070 
00071 
00072 /*************************************************************/
00073 /* GObject to  control sound. code get from maman-file.h     */
00074 /*************************************************************/
00075 /*
00076  * Potentially, include other headers on which this header depends.
00077  */
00078 #include <glib-object.h>
00079 
00080 #define GCOMPRIS_SOUND_TYPE          (gc_sound_get_type ())
00081 #define GCOMPRIS_SOUND(obj)          (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCOMPRIS_SOUND_TYPE, GcomprisSound))
00082 #define GCOMPRIS_SOUND_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GCOMPRIS_SOUND_TYPE, GcomprisSoundClass))
00083 #define GCOMPRIS_SOUND_IS(obj)       (G_TYPE_CHECK_INSTANCE_TYPE ((obj),  GCOMPRIS_SOUND_TYPE))
00084 #define GCOMPRIS_SOUND_IS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCOMPRIS_SOUND_TYPE))
00085 #define GCOMPRIS_SOUND_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GCOMPRIS_SOUND_TYPE, GcomprisSoundClass))
00086 
00087 typedef struct _GcomprisSound GcomprisSound;
00088 typedef struct _GcomprisSoundClass GcomprisSoundClass;
00089 typedef struct _GcomprisSoundPrivate GcomprisSoundPrivate;
00090 
00091 struct _GcomprisSound {
00092        GObject parent;
00093        /* instance members */
00094         GcomprisSoundPrivate *private;
00095 };
00096 
00097 struct _GcomprisSoundClass {
00098        GObjectClass parent;
00099 
00100         guint sound_played_signal_id;
00101         void (*sound_played) (GcomprisSound *self, gchar *file, gpointer user_data);
00102 };
00103 
00104 /* used by MAMAN_TYPE_FILE */
00105 GType gc_sound_get_type (void);
00106 
00107 /* API. */
00108 
00109 /* empty for now */
00110 
00111 
00112 /* Declaration of GCompris Sound Controller */
00113 extern GObject *gc_sound_controller;
00114 
00115 #endif