2
* gwavefile.h: wave utilities
4
* Copyright (c) 2000, 2001 David A. Bartold, Richard Guenther
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Library General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 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
* Library General Public License for more details.
16
* You should have received a copy of the GNU Library General Public
17
* License along with this library; if not, write to the
18
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
* Boston, MA 02111-1307, USA.
22
#ifndef __G_WAVEFILE_H__
23
#define __G_WAVEFILE_H__
28
typedef struct _GWavefile GWavefile;
29
typedef enum _GWavefileType GWavefileType;
34
G_WAVEFILE_TYPE_S32, G_WAVEFILE_TYPE_U32,
35
G_WAVEFILE_TYPE_S16, G_WAVEFILE_TYPE_U16,
36
G_WAVEFILE_TYPE_S8, G_WAVEFILE_TYPE_U8,
37
G_WAVEFILE_TYPE_F4, G_WAVEFILE_TYPE_F8,
38
G_WAVEFILE_TYPE_F4NI, G_WAVEFILE_TYPE_F8NI
42
/* Utility functions. */
44
double_to_s16 (gdouble d)
51
return (gint16) ((d + 1.0) * 32767.5 - 32768.0);
55
double_to_s32 (gdouble d)
58
return 0x7fffffff /* 2147483647 */;
60
return 0x80000000 /* -2147483648 */;
62
return (gint32) ((d + 1.0) * 2147483647.5 - 2147483648.0);
66
s32_to_double (gint32 i)
68
return (((double) i) + 2147483648.0) / 2147483647.5 - 1.0;
72
s16_to_double (gint16 i)
74
return (((double) i) + 32768.0) / 32767.5 - 1.0;
83
guint32 g_wavefile_type_width (GWavefileType dtype);
84
void g_wavefile_type_convert (guint32 n_channels,
86
GWavefileType out_type,
88
GWavefileType in_type,
90
void g_wavefile_type_clear (guint32 n_channels,
100
#endif /* __G_WAVEFILE_H__ */