Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/gc_sound/src/gc-sound-item.h
blob: 534252ea28ae79c79d9734834c28e7f6471c1e18 (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
/* gcompris - gc-sound-item.h
 *
 * Copyright (C) 2006 Yves Combe
 *
 *
 *   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
#ifndef __GC_SOUND_ITEM_H__
#define __GC_SOUND_ITEM_H__

#include <glib-object.h>

G_BEGIN_DECLS


typedef struct _GCSoundItem GCSoundItem;
typedef struct _GCSoundItemClass GCSoundItemClass;


G_END_DECLS
#include <gc-sound-channel.h>
G_BEGIN_DECLS


#define GC_TYPE_SOUND_ITEM         (gc_sound_item_get_type())
#define GC_SOUND_ITEM(i)           (G_TYPE_CHECK_INSTANCE_CAST((i), GC_TYPE_SOUND_ITEM, GCSoundItem))
#define GC_SOUND_ITEM_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST((c), GC_TYPE_SOUND_ITEM, GCSoundItemClass))
#define GC_IS_SOUND_ITEM(i)        (G_TYPE_CHECK_INSTANCE_TYPE((i), GC_TYPE_SOUND_ITEM))
#define GC_IS_SOUND_ITEM_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE((c), GC_TYPE_SOUND_ITEM))
#define GC_SOUND_ITEM_GET_CLASS(i) (G_TYPE_INSTANCE_GET_CLASS((i), GC_TYPE_SOUND_ITEM, GCSoundItemClass))

GType gc_sound_item_get_type(void);

struct _GCSoundItem {
  GObject         __parent__;

  gdouble         volume;
  gboolean        mute;

  GCSoundPolicy policy;
  //gint            policy;
  gboolean        loop;

  gchar*          filename;

  GCSoundChannel* channel;
  GCSoundItem*    parent;
  GList*          children;

  //debug. will be removed
  gchar * nick;

  //internal use
  // TRUE if we are in running play tree.
  gboolean has_played;

  // our group already started
  gboolean started;

  // child we are playing
  GList *playing;
};

struct _GCSoundItemClass {
  GObjectClass   __parentClass__;

  /* signal handlers */
  void        (* real_play)         (GCSoundItem * self);
  void        (* play_start)         (GCSoundItem * self);
  void        (* play_end)         (GCSoundItem * self, gboolean stopped);
  void        (* chunk_start)         (GCSoundItem * self);
  void        (* chunk_end)         (GCSoundItem * self, gboolean stopped);

};

// internal use
gboolean        gc_sound_item_run_next (GCSoundItem *self, 
                                        gboolean stopped);

GCSoundItem *   gc_sound_item_append_child (GCSoundItem *self);

gboolean        gc_sound_item_play (GCSoundItem *self);

void            gc_sound_item_set_filename (GCSoundItem *self, gchar *filename);

gchar *         gc_sound_item_get_filename (GCSoundItem *self);

void            gc_sound_item_set_loop(GCSoundItem *self, gboolean loop); 

G_END_DECLS

#endif