File: fmtheaders.h

package info (click to toggle)
gramofile 1.6-11
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 1,436 kB
  • ctags: 1,125
  • sloc: ansic: 11,252; makefile: 60
file content (77 lines) | stat: -rw-r--r-- 2,099 bytes parent folder | download | duplicates (4)
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
#ifndef _FMTHEADERS_H
#define _FMTHEADERS_H	1

#include <sys/types.h>

#ifdef __GNUC__
# define PACKED(x)      __attribute__((packed)) x
#else
# define PACKED(x)	x
#endif

/* Definitions for .VOC files */

#define VOC_MAGIC	"Creative Voice File\032"

#define DATALEN(bp)	((u_int32_t)(bp.BlockLen[0]) | \
                         ((u_int32_t)(bp.BlockLen[1]) << 8) | \
                         ((u_int32_t)(bp.BlockLen[2]) << 16) )

typedef struct vochead {
  u_int8_t  Magic[20];	/* must be VOC_MAGIC */
  u_int16_t BlockOffset;	/* Offset to first block from top of file */
  u_int16_t Version;	/* VOC-file version */
  u_int16_t IDCode;	/* complement of version + 0x1234 */
} PACKED(vochead);

typedef struct blockTC {
  u_int8_t  BlockID;
  u_int8_t  BlockLen[3];	/* low, mid, high byte of length of rest of block */
} PACKED(blockTC);

typedef struct blockT1 {
  u_int8_t  TimeConstant;
  u_int8_t  PackMethod;
} PACKED(blockT1);

typedef struct blockT8 {
  u_int16_t TimeConstant;
  u_int8_t  PackMethod;
  u_int8_t  VoiceMode;
} PACKED(blockT8);

typedef struct blockT9 {
  u_int32_t SamplesPerSec;
  u_int8_t  BitsPerSample;
  u_int8_t  Channels;
  u_int16_t Format;
  u_int8_t  reserved[4];
} PACKED(blockT9);
  


/* Definitions for Microsoft WAVE format */

/* 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 wavhead {
  u_int32_t	main_chunk;	/* 'RIFF' */
  u_int32_t	length;		/* Length of rest of file */
  u_int32_t	chunk_type;	/* 'WAVE' */

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

  u_int32_t	data_chunk;	/* 'data' */
  u_int32_t	data_length;	/* samplecount (lenth of rest of block?)*/
} PACKED(wavhead);

#endif