annotate Plugins/Visualization/paranormal/pn/pnaudiodata.h @ 1507:0c5fdcf3f947 trunk

[svn] - incomplete stuff
author nenolod
date Sun, 06 Aug 2006 01:53:29 -0700
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1507
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
1 /* Paranormal - A highly customizable audio visualization library
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
2 * Copyright (C) 2001 Jamie Gennis <jgennis@mindspring.com>
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
3 *
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
4 * This library is free software; you can redistribute it and/or
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
5 * modify it under the terms of the GNU Library General Public
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
6 * License as published by the Free Software Foundation; either
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
7 * version 2 of the License, or (at your option) any later version.
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
8 *
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
9 * This library is distributed in the hope that it will be useful,
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
12 * Library General Public License for more details.
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
13 *
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
14 * You should have received a copy of the GNU Library General Public
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
15 * License along with this library; if not, write to the Free
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
17 */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
18
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
19 #ifndef __PN_AUDIO_DATA_H__
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
20 #define __PN_AUDIO_DATA_H__
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
21
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
22 #include "pnobject.h"
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
23
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
24
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
25 G_BEGIN_DECLS
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
26
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
27 typedef enum
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
28 {
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
29 PN_CHANNEL_LEFT,
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
30 PN_CHANNEL_CENTER,
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
31 PN_CHANNEL_RIGHT
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
32 } PnAudioDataChannels;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
33
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
34 #define PN_TYPE_AUDIO_DATA (pn_audio_data_get_type ())
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
35 #define PN_AUDIO_DATA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PN_TYPE_AUDIO_DATA, PnAudioData))
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
36 #define PN_AUDIO_DATA_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), PN_TYPE_AUDIO_DATA, PnAudioDataClass))
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
37 #define PN_IS_AUDIO_DATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PN_TYPE_AUDIO_DATA))
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
38 #define PN_IS_AUDIO_DATA_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), PN_TYPE_AUDIO_DATA))
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
39 #define PN_AUDIO_DATA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PN_TYPE_AUDIO_DATA, PnAudioDataClass))
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
40 #define PN_AUDIO_DATA_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class))
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
41 #define PN_AUDIO_DATA_CLASS_NAME(class) (g_type_name (PN_AUDIO_DATA_CLASS_TYPE (class)))
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
42
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
43 #define PN_AUDIO_DATA_PCM_SAMPLES(obj) (PN_AUDIO_DATA (obj)->pcm_samples)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
44 #define PN_AUDIO_DATA_PCM_DATA(obj,ch) (PN_AUDIO_DATA (obj)->pcm_data[ch])
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
45 #define PN_AUDIO_DATA_FREQ_BANDS(obj) (PN_AUDIO_DATA (obj)->freq_bands)
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
46 #define PN_AUDIO_DATA_FREQ_DATA(obj,ch) (PN_AUDIO_DATA (obj)->freq_data[ch])
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
47
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
48 typedef struct _PnAudioData PnAudioData;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
49 typedef struct _PnAudioDataClass PnAudioDataClass;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
50
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
51 struct _PnAudioData
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
52 {
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
53 PnObject parent;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
54
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
55 /*< public >*/
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
56
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
57 /* PCM and frequency data are floats in the range of 0 to 1 */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
58
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
59 /* PCM Data */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
60 guint pcm_samples; /* read-only */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
61 gfloat *pcm_data[3]; /* read-write */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
62
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
63 /* Frequency Data */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
64 guint freq_bands; /* read-only */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
65 gfloat *freq_data[3]; /* read-write */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
66
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
67 /*< private >*/
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
68 /* If this is TRUE, each channel is separate, otherwise they all point
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
69 * to the same buffer. Default is TRUE.
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
70 */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
71 gboolean stereo;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
72
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
73 /* Overall volume of the audio frame */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
74 gfloat volume;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
75 };
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
76
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
77 struct _PnAudioDataClass
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
78 {
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
79 PnObjectClass parent_class;
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
80 };
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
81
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
82 /* Creators */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
83 GType pn_audio_data_get_type (void);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
84 PnAudioData *pn_audio_data_new (void);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
85
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
86 /* Accessors */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
87 void pn_audio_data_set_stereo (PnAudioData *audio_data,
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
88 gboolean stereo);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
89 gboolean pn_audio_data_get_stereo (PnAudioData *audio_data);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
90 void pn_audio_data_set_pcm_samples (PnAudioData *audio_data,
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
91 guint samples);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
92 guint pn_audio_data_get_pcm_samples (PnAudioData *audio_data);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
93 void pn_audio_data_set_freq_bands (PnAudioData *audio_data,
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
94 guint bands);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
95 guint pn_audio_data_get_freq_bands (PnAudioData *audio_data);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
96 gfloat pn_audio_data_get_volume (PnAudioData *audio_data);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
97
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
98 /* Actions */
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
99 void pn_audio_data_update (PnAudioData *audio_data);
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
100
0c5fdcf3f947 [svn] - incomplete stuff
nenolod
parents:
diff changeset
101 #endif /* __PN_AUDIO_DATA_H__ */