-
Notifications
You must be signed in to change notification settings - Fork 1
/
format_wav.h
45 lines (36 loc) · 1.16 KB
/
format_wav.h
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
#ifndef FORMAT_WAV_H
#define FORMAT_WAV_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#define WAV_BUF_SIZE 320
#define BLOCKSIZE 160
#define GAIN 0 /* 2^GAIN is the multiple to increase the volume by. The original value of GAIN was 2, or 4x (12 dB),
* but there were many reports of the clipping of loud signal peaks (issue 5823 for example). */
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define htoll(b) (b)
#define htols(b) (b)
#define ltohl(b) (b)
#define ltohs(b) (b)
#else
#if __BYTE_ORDER == __BIG_ENDIAN
#define htoll(b) \
(((((b) ) & 0xFF) << 24) | \
((((b) >> 8) & 0xFF) << 16) | \
((((b) >> 16) & 0xFF) << 8) | \
((((b) >> 24) & 0xFF) ))
#define htols(b) \
(((((b) ) & 0xFF) << 8) | \
((((b) >> 8) & 0xFF) ))
#define ltohl(b) htoll(b)
#define ltohs(b) htols(b)
#else
#error "Endianess not defined"
#endif
#endif
void slinear_saturated_add(short *input, short *value);
int wav_write_header(FILE *f, int samplerate, int stereo);
int wav_update_header(FILE *f);
int wav_mix(char *in1, char *in2, char *out, int samplerate, int swap, int stereo);
#endif //FORMAT_WAV_H