add a test for just-fixed crasher
[swfdec.git] / swfdec / swfdec_audio_event.h
blobcc4dcba8bc26e962d1b8396664cc3b9436f6c819
1 /* Swfdec
2 * Copyright (C) 2003-2006 David Schleef <ds@schleef.org>
3 * 2005-2006 Eric Anholt <eric@anholt.net>
4 * 2006-2007 Benjamin Otte <otte@gnome.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301 USA
22 #ifndef _SWFDEC_AUDIO_EVENT_H_
23 #define _SWFDEC_AUDIO_EVENT_H_
25 #include <swfdec/swfdec_audio_internal.h>
26 #include <swfdec/swfdec_sound.h>
28 G_BEGIN_DECLS
30 typedef struct _SwfdecAudioEvent SwfdecAudioEvent;
31 typedef struct _SwfdecAudioEventClass SwfdecAudioEventClass;
33 #define SWFDEC_TYPE_AUDIO_EVENT (swfdec_audio_event_get_type())
34 #define SWFDEC_IS_AUDIO_EVENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_AUDIO_EVENT))
35 #define SWFDEC_IS_AUDIO_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_AUDIO_EVENT))
36 #define SWFDEC_AUDIO_EVENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_AUDIO_EVENT, SwfdecAudioEvent))
37 #define SWFDEC_AUDIO_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_AUDIO_EVENT, SwfdecAudioEventClass))
38 #define SWFDEC_AUDIO_EVENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_AUDIO_EVENT, SwfdecAudioEventClass))
40 struct _SwfdecAudioEvent
42 SwfdecAudio audio;
44 /* static data */
45 SwfdecSound * sound; /* sound we're playing */
46 gsize start_sample; /* sample at which to start playing */
47 gsize stop_sample; /* first sample to not play anymore or 0 for playing all */
48 gsize n_loops; /* amount of times this sample still needs to be played back */
49 guint n_envelopes; /* amount of points in the envelope */
50 SwfdecSoundEnvelope * envelope; /* volume envelope or NULL if none */
51 /* dynamic data */
52 SwfdecBuffer * decoded; /* the decoded buffer we play back or NULL if failure */
53 gsize offset; /* current offset in 44.1kHz */
54 gsize loop; /* current loop we're in */
55 gsize n_samples; /* length of decoded buffer in 44.1kHz samples - can be 0 */
58 struct _SwfdecAudioEventClass
60 SwfdecAudioClass audio_class;
63 GType swfdec_audio_event_get_type (void);
65 SwfdecAudio * swfdec_audio_event_new (SwfdecPlayer * player,
66 SwfdecSound * sound,
67 guint offset,
68 guint n_loops);
69 SwfdecAudio * swfdec_audio_event_new_from_chunk (SwfdecPlayer * player,
70 SwfdecSoundChunk * chunk);
72 G_END_DECLS
73 #endif