1 /*****************************************************************************
5 ** Purpose: Header file for wdq2wav.cpp
6 ** Programmer: Kevin Rosenberg <kevin@rosenberg.net>
7 ** Date Started: Jan 2003
9 ** Copyright (c) 2003 Kevin Rosenberg
13 ** This program is free software; you can redistribute it and/or modify
14 ** it under the terms of the GNU General Public License (version 2) as
15 ** published by the Free Software Foundation.
17 ** This program 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.
22 ** You should have received a copy of the GNU General Public License
23 ** along with this program; if not, write to the Free Software
24 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 ******************************************************************************/
36 #include <sys/types.h>
47 #if __BYTE_ORDER == __BIG_ENDIAN
48 #define WORDS_BIG_ENDIAN 1
52 extern const char* g_szIdStr;
54 extern bool g_verbose;
57 #define MAX_INPUT_STR 256
59 void error_msg (const char *msg);
60 void info_msg (const char *msg);
61 void info_msg_sans_newline (const char *msg);
63 bool wdq2wav (const char* wdq_fname, const int channel, const char *wav_fname, bool play);
68 WindaqFile (const char* fname);
75 bool m_bLegacy_format;
79 unsigned long int m_nSamples;
81 std::string m_strFile;
82 unsigned int m_sr_denom, m_sr_numer;
83 unsigned short int m_nHeader_bytes, m_channel_offset, m_nBytes_channel_header;
84 unsigned int m_nData_bytes;
85 unsigned int m_time_acq_start;
86 unsigned int m_time_acq_stop;
87 double m_time_between_channel_samples;
89 bool any_packed_channels();
90 bool is_channel_packed(int iChannel);
97 signed short int *m_data;
100 unsigned int m_channel;
103 signed short int m_min_raw_data;
104 signed short int m_max_raw_data;
105 double m_max_scaled_data;
106 double m_min_scaled_data;
109 WindaqChannel (WindaqFile& wdq, const int channel);
111 double raw2measured(signed short int raw) const { return (raw * m_slope) + m_intercept; }
114 bool read_channel_data();
122 signed short int* m_data;
123 unsigned long int m_nSamples;
124 std::string m_strFile;
127 unsigned int m_nChannels;
128 unsigned int m_nBitsPerSample;
129 unsigned int m_nBytesPerSample;
130 unsigned long int m_nHeaderBytes;
131 long int m_nDataBytes;
132 long int m_nFileBytes;
134 WavFile (WindaqChannel& wdq_channel, const char* fname);
146 inline T nearest (double x)
149 static_cast<T>(x+0.5) : static_cast<T>(x-0.5));