FreeWRL/FreeX3D
3.0.0
Main Page
Related Pages
Data Structures
Files
File List
soundheader.h
1
/*********************************************************************
2
*
3
* FreeWRL SoundServer engine
4
*
5
*********************************************************************/
6
7
/****************************************************************************
8
This file is part of the FreeWRL/FreeX3D Distribution.
9
10
Copyright 2009 CRC Canada. (http://www.crc.gc.ca)
11
12
FreeWRL/FreeX3D is free software: you can redistribute it and/or modify
13
it under the terms of the GNU Lesser Public License as published by
14
the Free Software Foundation, either version 3 of the License, or
15
(at your option) any later version.
16
17
FreeWRL/FreeX3D is distributed in the hope that it will be useful,
18
but WITHOUT ANY WARRANTY; without even the implied warranty of
19
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
GNU General Public License for more details.
21
22
You should have received a copy of the GNU General Public License
23
along with FreeWRL/FreeX3D. If not, see <http://www.gnu.org/licenses/>.
24
****************************************************************************/
25
26
27
28
#ifndef __FREEWRL_SND_SOUND_H__
29
#define __FREEWRL_SND_SOUND_H__
30
31
32
#define UNKNOWNFILE 0
33
#define WAVFILE 3
34
#define MPGFILE 1
35
#define MP3FILE 2
36
37
#define DSP "/dev/dsp"
38
39
#define MAXSOURCES 128
40
#define BUFSIZE 512
41
#define MAXBUFSIZE 8192
42
#define NUMBUFS 2
43
44
/* number of fragments */
45
#define N_FRAGMENTS 48
46
/* a buffersize of 2^8 = 256 bytes */
47
#define FRAG_SIZE 8
48
49
#define FormatID 'fmt '
/* chunkID for Format Chunk. NOTE: There is a space at the end of this ID. */
50
51
typedef
struct
{
52
char
chunkID[4];
53
int
chunkSize;
54
short
wFormatTag;
55
unsigned
short
wChannels;
56
unsigned
int
dwSamplesPerSec;
57
unsigned
int
dwAvgBytesPerSec;
58
unsigned
short
wBlockAlign;
59
unsigned
short
wBitsPerSample;
60
}
fmtChnk
;
61
62
63
#define DataID 'data'
/* chunk ID for data Chunk */
64
65
typedef
struct
{
66
char
chunkID[4];
67
int32_t chunkSize;
68
}
datChnk
;
69
70
typedef
struct
{
71
long
mtype;
/* message type */
72
char
msg[256];
/* message data */
73
}
FWSNDMSG
;
74
75
typedef
struct
{
76
int
type;
/* // 1 = wav, etc, etc */
77
FILE *fd;
/* // file descriptor of sound file */
78
char
data[MAXBUFSIZE];
/* // data read in from file */
79
int
dataptr;
/* // where in the data field we are */
80
int
wavdataoffset;
/* // this is the offset from start of file to wave data */
81
float
pitch;
/* // pitch multiplier */
82
int
bytes_remaining;
/* // how many bytes until EOF is reached - used in */
83
/* // playing the file */
84
/* // */
85
int
ampl;
/* // Gain of this sound */
86
int
balance;
/* // L-R pairing. */
87
88
fmtChnk
FormatChunk;
/* // the "fmt " chunk is copied here */
89
datChnk
DataChunk;
/* // the one and only one "data" chunk is copied here */
90
91
}
SNDFILE
;
92
93
extern
short
int
CombiningBuffer[MAXBUFSIZE];
94
extern
int
MaxAvgBytes;
95
extern
int
active[MAXSOURCES];
96
extern
int
registered[MAXSOURCES];
97
void
addToCombiningBuffer(
int
count,
int
readSize,
int
offset);
98
extern
SNDFILE
*sndfile[MAXSOURCES];
99
extern
int
loop[MAXSOURCES];
100
extern
int
current_max;
101
extern
int
readSize;
102
103
extern
int
dspFile;
104
extern
float
fps;
105
void
closeDSP();
106
SNDFILE
*initiateWAVSound (
SNDFILE
*wavfile,
int
mynum);
107
void
playWavFragment ();
108
void
initiateDSP ();
109
void
rewind_to_beginning (
SNDFILE
*wavfile);
110
void
recordMaxWavParams(
SNDFILE
*me);
111
void
streamMoreData(
int
size);
112
void
adjustAmplitude(
int
source,
int
readSize);
113
114
/* // bits per sample: */
115
#define EIGHT 8
116
#define SIXTEEN 16
117
#define THIRTYTWO 32
118
119
#define UNINITWAV -20000
120
121
122
#endif
/* __FREEWRL_SND_SOUND_H__ */
fmtChnk
Definition:
soundheader.h:51
SNDFILE
Definition:
soundheader.h:75
datChnk
Definition:
soundheader.h:65
FWSNDMSG
Definition:
sounds.h:49
src
sound
soundheader.h
Generated on Thu Dec 14 2017 12:15:25 for FreeWRL/FreeX3D by
1.8.6