+wdq2wav (0.5.0-1) unstable; urgency=low
+
+ * New upstream, add support for scaling while preserving zero point
+
+ -- Kevin M. Rosenberg <kmr@debian.org> Mon, 24 Feb 2003 01:39:51 -0700
+
wdq2wav (0.4.0-1) unstable; urgency=low
- * New upstream, add support for MSVC compilation.
+ * Support for MSVC compilation.
-- Kevin M. Rosenberg <kmr@debian.org> Tue, 11 Feb 2003 23:06:52 -0700
**
** Copyright (c) 2003 Kevin Rosenberg
**
-** $Id: wdq2wav.cpp,v 1.16 2003/02/12 07:24:32 kevin Exp $
+** $Id: wdq2wav.cpp,v 1.17 2003/02/24 08:40:25 kevin Exp $
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License (version 2) as
#include <wdq2wav.h>
-const char* g_szIdStr = "$Id: wdq2wav.cpp,v 1.16 2003/02/12 07:24:32 kevin Exp $";
+const char* g_szIdStr = "$Id: wdq2wav.cpp,v 1.17 2003/02/24 08:40:25 kevin Exp $";
bool g_quiet = false;
bool g_verbose = false;
bool g_debug = false;
+bool g_ignore_zero = false;
#ifdef WIN32
{
std::cout << "usage: " << fileBasename (progname) << " [OPTIONS] <wdq-file> <channel-number> <wav-file>\n";
std::cout << "OPTIONS\n";
- std::cout << " -p Play channel through audio system\n";
- std::cout << " -q Supress all messages\n";
- std::cout << " -v Verbose mode\n";
- std::cout << " -d Debug mode\n";
- std::cout << " -r Print program version\n";
- std::cout << " -h Print this help message\n";
+ std::cout << " -p Play channel through audio system\n";
+ std::cout << " -q Supress all messages\n";
+ std::cout << " -z Scale output without regard for windaq zero point\n";
+ std::cout << " -v Verbose mode\n";
+ std::cout << " -d Debug mode\n";
+ std::cout << " -r Print program version\n";
+ std::cout << " -h Print this help message\n";
}
", maximum: " << wdq_channel.m_max_raw_data;
info_msg (os3.str().c_str());
}
+
if (g_debug) {
std::ostringstream os4;
os4 << " Scaled minimum: " << wdq_channel.m_min_scaled_data <<
m_nBitsPerSample = 16;
m_nBytesPerSample = 2;
m_rate = wdq_channel.r_wdq.m_sample_rate;
-
- double data_offset = -wdq_channel.m_min_scaled_data;
- double data_scale = 0.;
- if (wdq_channel.m_max_scaled_data != wdq_channel.m_min_scaled_data)
- data_scale = 65535. / (wdq_channel.m_max_scaled_data -
- wdq_channel.m_min_scaled_data);
+
+ double data_offset = 0, data_scale = 0;
+ if (g_ignore_zero) {
+ data_offset = -wdq_channel.m_min_scaled_data;
+ if (wdq_channel.m_max_scaled_data != wdq_channel.m_min_scaled_data)
+ data_scale = 65535. / (wdq_channel.m_max_scaled_data -
+ wdq_channel.m_min_scaled_data);
+ } else {
+ double max_value = fabs(wdq_channel.m_max_scaled_data);
+ if (fabs(wdq_channel.m_min_scaled_data) > max_value)
+ max_value = fabs(wdq_channel.m_min_scaled_data);
+ data_scale = 32767. / max_value;
+ }
if (g_debug) {
std::ostringstream os;
double value = input[i];
value = (slope * value) + intercept;
value = (value + data_offset) * data_scale;
- value += 0.5 - 32768;
+ if (g_ignore_zero)
+ value += 0.5 - 32768;
signed short int v = static_cast<signed short int>(value);
#if WORDS_BIG_ENDIAN
unsigned char* p = reinterpret_cast<unsigned char*>(&v);