Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/gcompris/soundutil.h
blob: b5fe904ef59cf26717cd008e64b410d855d8001f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* gcompris - gameutil.h
 *
 * Time-stamp: <2000/07/16 00:32:26 bruno>
 *
 * Copyright (C) 2000 Bruno Coudoin
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
#ifndef SOUNDUTIL_H
#define SOUNDUTIL_H

#include <stdio.h>
#include "gcompris.h"

#define MAX_QUEUE_LENGTH 5
#define MAX_SOUND_FILES 20

typedef enum
{
  PLAY_ONLY_IF_IDLE		= 0,
  PLAY_AFTER_CURRENT		= 1,
} SoundPolicy;

typedef void (*GcomprisSoundCallback) (gchar *);

void	 gc_sound_play_ogg(const gchar *, ...);
void	 gc_sound_play_ogg_cb(const gchar *, GcomprisSoundCallback);
void	 gc_sound_play_ogg_list( GList* files );
void	 gc_sound_policy_set(int);
int	 gc_sound_policy_get(void);
void	 gc_sound_init(void);
void	 gc_sound_reopen(void);
void	 gc_sound_close(void);
void	 gc_sound_pause(void);
void	 gc_sound_resume(void);

int	 decode_ogg_file(char *infile);
void	 display_ao_devices();

/*
 * SDL PLAYER
 */
int	 sdlplayer_init();
int	 sdlplayer_bg();
void	 sdlplayer_close();
void	 sdlplayer_reopen();
void	 sdlplayer_pause();
void	 sdlplayer_resume();
int	 sdlplayer(char *filename, int volume);

gchar *gc_sound_alphabet(gchar *chars);


/*************************************************************/
/* GObject to  control sound. code get from maman-file.h     */
/*************************************************************/
/*
 * Potentially, include other headers on which this header depends.
 */
#include <glib-object.h>

#define GCOMPRIS_SOUND_TYPE 	  (gc_sound_get_type ())
#define GCOMPRIS_SOUND(obj)		  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCOMPRIS_SOUND_TYPE, GcomprisSound))
#define GCOMPRIS_SOUND_CLASS(klass)	  (G_TYPE_CHECK_CLASS_CAST ((klass), GCOMPRIS_SOUND_TYPE, GcomprisSoundClass))
#define GCOMPRIS_SOUND_IS(obj)	  (G_TYPE_CHECK_INSTANCE_TYPE ((obj),  GCOMPRIS_SOUND_TYPE))
#define GCOMPRIS_SOUND_IS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCOMPRIS_SOUND_TYPE))
#define GCOMPRIS_SOUND_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GCOMPRIS_SOUND_TYPE, GcomprisSoundClass))

typedef struct _GcomprisSound GcomprisSound;
typedef struct _GcomprisSoundClass GcomprisSoundClass;
typedef struct _GcomprisSoundPrivate GcomprisSoundPrivate;

struct _GcomprisSound {
	GObject parent;
	/* instance members */
        GcomprisSoundPrivate *private;
};

struct _GcomprisSoundClass {
	GObjectClass parent;
        
        guint sound_played_signal_id;
        void (*sound_played) (GcomprisSound *self, gchar *file, gpointer user_data);
};

/* used by MAMAN_TYPE_FILE */
GType gc_sound_get_type (void);

/* API. */

/* empty for now */


/* Declaration of GCompris Sound Controller */
extern GObject *gc_sound_controller;

#endif