1 /*
2 * Copyright (C) 2007,2008 Jeremy sG <sg at hacksess>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 */
19
20
21 typedef unsigned char UCHAR;
22
23 // For ALSA calls
24 struct SND2dev
25 {
26 snd_pcm_t *pcm_handle;
27 snd_pcm_hw_params_t *hw_params;
28 };
29
30 // Wave File Header Info
31 // in order they're read
32 struct WaveHeader
33 {
34 UCHAR *Name;
35 UCHAR *cnkID[4]; // Byte 0-3 : Chunk ID (= "RIFF")
36 uint fileSize; // Byte 4-7 : Fize Size (minus first 8 bytes)
37 UCHAR *fmtName[4]; // Byte 8-11 : Format (= "WAVE")
38 UCHAR *scnkID[4]; // Byte 12-15: SubChunk 1 ID (= "fmt")
39 uint sSize; // Byte 16-19: SubChunk 1 Size (= 16)
40 uint codec; // Byte 20-21: Audio Format (= 1,++)
41 uint chans; // Byte 22-23: Num of Channels (1,2,++)
42 uint sampRate; // Byte 24-27: Sample Rate (= 22050,44100,+/-)
43 uint bRate; // Byte 28-31: Byte Rate (???)
44 uint bAlign; // Byte 32-33: Block Align (???)
45 uint bpsmpl; // Byte 34-35: Bits Per Sample (???)
46 UCHAR *scnk2ID[4]; // Byte 36-39: SubChunk 2 ID (= "data")
47 uint scnk2size; // Byte 40-43: SubChunk 2 Size
48 };
49
header_byte(UCHAR * buffer,int bytc)50 UCHAR header_byte(UCHAR *buffer, int bytc)
51 {
52 return ((uint)buffer[bytc+3] << 24) | ((uint)buffer[bytc+2] << 16) | ((uint)buffer[bytc+1] << 8) | ((uint)buffer[bytc]);
53 }
54
55