r3817: *** empty log message ***
[wdq2wav.git] / wdq2wav.h
1 #include <stdio.h>
2 #include <string>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <fcntl.h>
6 #include <unistd.h>
7
8 class WindaqFile
9 {
10 public:
11   WindaqFile (const char* fname);
12   ~WindaqFile ();
13   bool ReadHeader();
14
15   std::string m_strFile;
16   bool m_valid;
17   int m_fd;
18   unsigned int m_nChannels;
19   unsigned int m_nSamples;
20   double m_sample_rate;
21   unsigned int m_sr_denom, m_sr_numer;
22   unsigned int m_nHeader_bytes, m_channel_offset, m_nBytes_channel_header;
23   unsigned int m_nData_bytes;
24 };
25
26 class WindaqChannel 
27 {
28 public:
29   bool m_valid;
30   unsigned int m_channel;
31   std::string m_units;
32   double m_slope;
33   double m_intercept;
34   signed short int *m_data;
35   WindaqFile& r_wdq;
36   signed short int m_min_raw_data;
37   signed short int m_max_raw_data;
38   double m_max_scaled_data;
39   double m_min_scaled_data;
40
41   WindaqChannel (WindaqFile& wdq, const int channel);
42   ~WindaqChannel ();
43
44  private:
45   bool read_channel_data();
46 };
47
48
49 class WavFile 
50 {
51  public:
52   std::string m_strFile;
53   int m_fd;
54   bool m_valid;
55   unsigned long int m_nSamples;
56   double m_rate;
57   unsigned int m_nChannels;
58   unsigned int m_nBitsPerSample;
59   unsigned int m_nBytesPerSample;
60   signed short int* m_data;
61
62   WavFile (WindaqChannel& wdq_channel, const char* fname);
63   ~WavFile ();
64
65   bool WriteFile ();
66 };