* Add warning if -c option and something conflicting with it are both given

* Fixes for mingw32 compile
* Fix a couple of compiler warnings
This commit is contained in:
Chris Cannam
2008-07-07 18:54:18 +00:00
parent 167760625a
commit d6d4af1539
7 changed files with 38 additions and 36 deletions

View File

@@ -35,7 +35,7 @@ AudioCurve::process(const double *R__ mag, size_t increment)
{
cerr << "WARNING: Using inefficient AudioCurve::process(double)" << endl;
float *tmp = new float[m_windowSize];
for (int i = 0; i < m_windowSize; ++i) tmp[i] = float(mag[i]);
for (int i = 0; i < int(m_windowSize); ++i) tmp[i] = float(mag[i]);
float df = process(tmp, increment);
delete[] tmp;
return df;

View File

@@ -249,7 +249,7 @@ RubberBandStretcher::Impl::setPitchScale(double fs)
m_pitchScale != 1.f) {
// resampling mode has changed
for (int c = 0; c < m_channels; ++c) {
for (int c = 0; c < int(m_channels); ++c) {
if (m_channelData[c]->resampler) {
m_channelData[c]->resampler->reset();
}
@@ -932,7 +932,7 @@ RubberBandStretcher::Impl::calculateStretch()
if (i >= m_silence.size()) break;
if (m_silence[i]) ++history;
else history = 0;
if (history >= (m_windowSize / m_increment) && increments[i] >= 0) {
if (history >= int(m_windowSize / m_increment) && increments[i] >= 0) {
increments[i] = -increments[i];
if (m_debugLevel > 1) {
std::cerr << "phase reset on silence (silent history == "

View File

@@ -504,11 +504,11 @@ RubberBandStretcher::Impl::calculateIncrements(size_t &phaseIncrementRtn,
if (silent) ++m_silentHistory;
else m_silentHistory = 0;
if (m_silentHistory >= (m_windowSize / m_increment) && !phaseReset) {
if (m_silentHistory >= int(m_windowSize / m_increment) && !phaseReset) {
phaseReset = true;
if (m_debugLevel > 1) {
std::cerr << "calculateIncrements: phase reset on silence (silent history == "
<< m_silentHistory << ")" << std::endl;
cerr << "calculateIncrements: phase reset on silence (silent history == "
<< m_silentHistory << ")" << endl;
}
}
}
@@ -1067,7 +1067,7 @@ RubberBandStretcher::Impl::writeChunk(size_t channel, size_t shiftIncrement, boo
windowAccumulator[i] = 0.0f;
}
if (cd.accumulatorFill > si) {
if (int(cd.accumulatorFill) > si) {
cd.accumulatorFill -= si;
} else {
cd.accumulatorFill = 0;

View File

@@ -31,19 +31,9 @@
* SUCH DAMAGE.
*/
/*#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
#endif /* LIBC_SCCS and not lint
#include <sys/cdefs.h>
//__FBSDID("$FreeBSD: src/lib/libc/stdlib/getopt.c,v 1.6 2002/03/29 22:43:42 markm Exp $");
#include "namespace.h"*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*#include "un-namespace.h"*/
/*#include "libc_private.h"*/
int opterr = 1, /* if error message should be printed */
optind = 1, /* index into parent argv vector */

View File

@@ -22,7 +22,7 @@
#include <cstring>
#include "sysutils.h"
#ifdef _WIN32
#ifdef __MSVC__
#include "bsd-3rdparty/getopt/getopt.h"
#else
#include <getopt.h>
@@ -78,6 +78,7 @@ int main(int argc, char **argv)
bool hqpitch = false;
bool softening = true;
bool formant = false;
bool crispchanged = false;
int crispness = -1;
bool help = false;
bool version = false;
@@ -138,11 +139,11 @@ int main(int argc, char **argv)
case 'F': formant = true; break;
case '0': threading = 1; break;
case '@': threading = 2; break;
case '1': transients = NoTransients; break;
case '2': peaklock = false; break;
case '3': longwin = true; break;
case '4': shortwin = true; break;
case '8': transients = BandLimitedTransients; break;
case '1': transients = NoTransients; crispchanged = true; break;
case '2': peaklock = false; crispchanged = true; break;
case '3': longwin = true; crispchanged = true; break;
case '4': shortwin = true; crispchanged = true; break;
case '8': transients = BandLimitedTransients; crispchanged = true; break;
case '9': softening = false; break;
case '%': hqpitch = true; break;
case 'c': crispness = atoi(optarg); break;
@@ -215,6 +216,11 @@ int main(int argc, char **argv)
return 2;
}
if (crispness >= 0 && crispchanged) {
cerr << "WARNING: Both crispness option and transients, peaklock or window options" << endl;
cerr << " provided -- crispness will override these other options" << endl;
}
switch (crispness) {
case -1: crispness = 4; break;
case 0: transients = NoTransients; peaklock = false; longwin = true; shortwin = false; break;

View File

@@ -15,8 +15,25 @@
#ifndef _RUBBERBAND_SYSINFO_H_
#define _RUBBERBAND_SYSINFO_H_
#ifdef _WIN32
#ifdef __MSVC__
#include "bsd-3rdparty/float_cast/float_cast.h"
#define R__ __restrict
#endif
#ifdef __GNUC__
#define R__ __restrict__
#endif
#ifndef R__
#define R__
#endif
#ifdef __MINGW32__
#include <malloc.h>
#endif
#ifdef __MSVC__
#define alloca _alloca
#endif
namespace RubberBand {
@@ -25,19 +42,11 @@ extern bool system_is_multiprocessor();
#ifdef _WIN32
#define R__ __restrict
struct timeval { long tv_sec; long tv_usec; };
int gettimeofday(struct timeval *p, void *tz);
void usleep(unsigned long);
#define alloca _alloca
#else
#define R__ __restrict__
#endif
}

View File

@@ -15,13 +15,10 @@
#include "RubberBandVampPlugin.h"
#include "StretchCalculator.h"
#include "sysutils.h"
#include <cmath>
#ifdef _WIN32
#include "bsd-3rdparty/float_cast/float_cast.h"
#endif
using std::string;
using std::vector;
using std::cerr;