File: fmtheaders.h

package info (click to toggle)
fbb 7.04j-8.2
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 3,504 kB
  • ctags: 5,359
  • sloc: ansic: 85,097; sh: 985; makefile: 304
file content (112 lines) | stat: -rw-r--r-- 3,014 bytes parent folder | download | duplicates (8)
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
110
111
112
   /****************************************************************
    Copyright (C) 1986-2000 by

    F6FBB - Jean-Paul ROUBELAT
    6, rue George Sand
    31120 - Roquettes - France
	jpr@f6fbb.org

    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

    Parts of code have been taken from many other softwares.
    Thanks for the help.
    ****************************************************************/
#ifndef _FMTHEADERS_H
#define _FMTHEADERS_H	1

#include <sys/types.h>

/* Definitions for .VOC files */

#define MAGIC_STRING	"Creative Voice File\0x1A"
#define ACTUAL_VERSION	0x010A
#define VOC_SAMPLESIZE	8

#define MODE_MONO	0
#define MODE_STEREO	1

#define DATALEN(bp)	((u_long)(bp->datalen) | \
                         ((u_long)(bp->datalen_m) << 8) | \
                         ((u_long)(bp->datalen_h) << 16) )

typedef struct _vocheader
{
	u_char magic[20];			/* must be MAGIC_STRING */
	u_short headerlen;			/* Headerlength, should be 0x1A */
	u_short version;			/* VOC-file version */
	u_short coded_ver;			/* 0x1233-version */
}
VocHeader;

typedef struct _blocktype
{
	u_char type;
	u_char datalen;				/* low-byte    */
	u_char datalen_m;			/* medium-byte */
	u_char datalen_h;			/* high-byte   */
}
BlockType;

typedef struct _voice_data
{
	u_char tc;
	u_char pack;
}
Voice_data;

typedef struct _ext_block
{
	u_short tc;
	u_char pack;
	u_char mode;
}
Ext_Block;


/* Definitions for Microsoft WAVE format */

#define RIFF		0x46464952
#define WAVE		0x45564157
#define FMT		0x20746D66
#define DATA		0x61746164
#define PCM_CODE	1
#define WAVE_MONO	1
#define WAVE_STEREO	2

/* it's in chunks like .voc and AMIGA iff, but my source say there
   are in only in this combination, so I combined them in one header;
   it works on all WAVE-file I have
 */
typedef struct _waveheader
{
	u_long main_chunk;			/* 'RIFF' */
	u_long length;				/* filelen */
	u_long chunk_type;			/* 'WAVE' */

	u_long sub_chunk;			/* 'fmt ' */
	u_long sc_len;				/* length of sub_chunk, =16 */
	u_short format;				/* should be 1 for PCM-code */
	u_short modus;				/* 1 Mono, 2 Stereo */
	u_long sample_fq;			/* frequence of sample */
	u_long byte_p_sec;
	u_short byte_p_spl;			/* samplesize; 1 or 2 bytes */
	u_short bit_p_spl;			/* 8, 12 or 16 bit */

	u_long data_chunk;			/* 'data' */
	u_long data_length;			/* samplecount */
}
WaveHeader;

#endif