fb8d0e00809c98f8741c67de225407de2c347a5b
[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 #include <sstream>
8 #include <time.h>
9
10 class WindaqFile
11 {
12 public:
13   WindaqFile (const char* fname);
14   ~WindaqFile ();
15   bool ReadHeader();
16
17   std::string m_strFile;
18   bool m_valid;
19   int m_fd;
20   unsigned int m_nChannels;
21   unsigned int m_nSamples;
22   double m_sample_rate;
23   unsigned int m_sr_denom, m_sr_numer;
24   unsigned int m_nHeader_bytes, m_channel_offset, m_nBytes_channel_header;
25   unsigned int m_nData_bytes;
26   unsigned long int m_time_acq_start;
27   unsigned long int m_time_acq_stop;
28 };
29
30 class WindaqChannel 
31 {
32 public:
33   bool m_valid;
34   unsigned int m_channel;
35   std::string m_units;
36   double m_slope;
37   double m_intercept;
38   signed short int *m_data;
39   WindaqFile& r_wdq;
40   signed short int m_min_raw_data;
41   signed short int m_max_raw_data;
42   double m_max_scaled_data;
43   double m_min_scaled_data;
44
45   WindaqChannel (WindaqFile& wdq, const int channel);
46   ~WindaqChannel ();
47
48  private:
49   bool read_channel_data();
50 };
51
52
53 class WavFile 
54 {
55  public:
56   std::string m_strFile;
57   int m_fd;
58   bool m_valid;
59   unsigned long int m_nSamples;
60   double m_rate;
61   unsigned int m_nChannels;
62   unsigned int m_nBitsPerSample;
63   unsigned int m_nBytesPerSample;
64   signed short int* m_data;
65
66   WavFile (WindaqChannel& wdq_channel, const char* fname);
67   ~WavFile ();
68
69   bool WriteFile ();
70 };