Update to new combined build

This commit is contained in:
Chris Cannam
2012-09-09 16:57:42 +01:00
parent 4ecb1fa6f1
commit 93c38b50a0
77 changed files with 10427 additions and 897 deletions

View File

@@ -1,15 +1,24 @@
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
Rubber Band
Rubber Band Library
An audio time-stretching and pitch-shifting library.
Copyright 2007-2011 Chris Cannam.
Copyright 2007-2012 Particular Programs Ltd.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
Alternatively, if you have a valid commercial licence for the
Rubber Band Library obtained by agreement with the copyright
holders, you may redistribute and/or modify it under the terms
described in that licence.
If you wish to distribute code using the Rubber Band Library
under terms other than those of the GNU General Public License,
you must obtain a valid commercial licence before doing so.
*/
#include "Profiler.h"
@@ -19,7 +28,12 @@
#include <string>
#include <map>
#include <cstdio>
#include <stdio.h>
#ifdef __MSVC__
// Ugh --cc
#define snprintf sprintf_s
#endif
namespace RubberBand {
@@ -53,39 +67,23 @@ Profiler::add(const char *id, float ms)
void
Profiler::dump()
{
std::string report = getReport();
fprintf(stderr, "%s", report.c_str());
}
std::string
Profiler::getReport()
{
static const int buflen = 256;
char buffer[buflen];
std::string report;
#ifdef PROFILE_CLOCKS
fprintf(stderr, "Profiling points [CPU time]:\n");
snprintf(buffer, buflen, "Profiling points [CPU time]:\n");
#else
fprintf(stderr, "Profiling points [Wall time]:\n");
snprintf(buffer, buflen, "Profiling points [Wall time]:\n");
#endif
fprintf(stderr, "\nBy name:\n");
typedef std::set<const char *, std::less<std::string> > StringSet;
StringSet profileNames;
for (ProfileMap::const_iterator i = m_profiles.begin();
i != m_profiles.end(); ++i) {
profileNames.insert(i->first);
}
for (StringSet::const_iterator i = profileNames.begin();
i != profileNames.end(); ++i) {
ProfileMap::const_iterator j = m_profiles.find(*i);
if (j == m_profiles.end()) continue;
const TimePair &pp(j->second);
fprintf(stderr, "%s(%d):\n", *i, pp.first);
fprintf(stderr, "\tReal: \t%f ms \t[%f ms total]\n",
(pp.second / pp.first),
(pp.second));
WorstCallMap::const_iterator k = m_worstCalls.find(*i);
if (k == m_worstCalls.end()) continue;
fprintf(stderr, "\tWorst:\t%f ms/call\n", k->second);
}
report += buffer;
typedef std::multimap<float, const char *> TimeRMap;
typedef std::multimap<int, const char *> IntRMap;
@@ -105,29 +103,71 @@ Profiler::dump()
worstmap.insert(TimeRMap::value_type(i->second, i->first));
}
fprintf(stderr, "\nBy total:\n");
snprintf(buffer, buflen, "\nBy total:\n");
report += buffer;
for (TimeRMap::const_iterator i = totmap.end(); i != totmap.begin(); ) {
--i;
fprintf(stderr, "%-40s %f ms\n", i->second, i->first);
snprintf(buffer, buflen, "%-40s %f ms\n", i->second, i->first);
report += buffer;
}
fprintf(stderr, "\nBy average:\n");
snprintf(buffer, buflen, "\nBy average:\n");
report += buffer;
for (TimeRMap::const_iterator i = avgmap.end(); i != avgmap.begin(); ) {
--i;
fprintf(stderr, "%-40s %f ms\n", i->second, i->first);
snprintf(buffer, buflen, "%-40s %f ms\n", i->second, i->first);
report += buffer;
}
fprintf(stderr, "\nBy worst case:\n");
snprintf(buffer, buflen, "\nBy worst case:\n");
report += buffer;
for (TimeRMap::const_iterator i = worstmap.end(); i != worstmap.begin(); ) {
--i;
fprintf(stderr, "%-40s %f ms\n", i->second, i->first);
snprintf(buffer, buflen, "%-40s %f ms\n", i->second, i->first);
report += buffer;
}
fprintf(stderr, "\nBy number of calls:\n");
snprintf(buffer, buflen, "\nBy number of calls:\n");
report += buffer;
for (IntRMap::const_iterator i = ncallmap.end(); i != ncallmap.begin(); ) {
--i;
fprintf(stderr, "%-40s %d\n", i->second, i->first);
snprintf(buffer, buflen, "%-40s %d\n", i->second, i->first);
report += buffer;
}
snprintf(buffer, buflen, "\nBy name:\n");
report += buffer;
typedef std::set<const char *, std::less<std::string> > StringSet;
StringSet profileNames;
for (ProfileMap::const_iterator i = m_profiles.begin();
i != m_profiles.end(); ++i) {
profileNames.insert(i->first);
}
for (StringSet::const_iterator i = profileNames.begin();
i != profileNames.end(); ++i) {
ProfileMap::const_iterator j = m_profiles.find(*i);
if (j == m_profiles.end()) continue;
const TimePair &pp(j->second);
snprintf(buffer, buflen, "%s(%d):\n", *i, pp.first);
report += buffer;
snprintf(buffer, buflen, "\tReal: \t%f ms \t[%f ms total]\n",
(pp.second / pp.first),
(pp.second));
report += buffer;
WorstCallMap::const_iterator k = m_worstCalls.find(*i);
if (k == m_worstCalls.end()) continue;
snprintf(buffer, buflen, "\tWorst:\t%f ms/call\n", k->second);
report += buffer;
}
return report;
}
Profiler::Profiler(const char* c) :

View File

@@ -1,15 +1,24 @@
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
Rubber Band
Rubber Band Library
An audio time-stretching and pitch-shifting library.
Copyright 2007-2011 Chris Cannam.
Copyright 2007-2012 Particular Programs Ltd.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
Alternatively, if you have a valid commercial licence for the
Rubber Band Library obtained by agreement with the copyright
holders, you may redistribute and/or modify it under the terms
described in that licence.
If you wish to distribute code using the Rubber Band Library
under terms other than those of the GNU General Public License,
you must obtain a valid commercial licence before doing so.
*/
#ifndef _PROFILER_H_
@@ -40,7 +49,10 @@
#endif
#endif
#ifndef NO_TIMING
#include <map>
#include <string>
#endif
namespace RubberBand {
@@ -56,6 +68,12 @@ public:
static void dump();
// Unlike the other functions, this is only defined if NO_TIMING
// is not set (because it uses std::string which is otherwise
// unused here). So, treat this as a tricksy internal function
// rather than an API call and guard any call to it appropriately.
static std::string getReport();
protected:
const char* m_c;
#ifdef PROFILE_CLOCKS

View File

@@ -1,15 +1,24 @@
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
Rubber Band
Rubber Band Library
An audio time-stretching and pitch-shifting library.
Copyright 2007-2011 Chris Cannam.
Copyright 2007-2012 Particular Programs Ltd.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
Alternatively, if you have a valid commercial licence for the
Rubber Band Library obtained by agreement with the copyright
holders, you may redistribute and/or modify it under the terms
described in that licence.
If you wish to distribute code using the Rubber Band Library
under terms other than those of the GNU General Public License,
you must obtain a valid commercial licence before doing so.
*/
#ifndef _RUBBERBAND_RINGBUFFER_H_
@@ -47,7 +56,7 @@ public:
* power of two, this means n should ideally be some power of two
* minus one.
*/
RingBuffer(int n = 0);
RingBuffer(int n);
virtual ~RingBuffer();
@@ -268,8 +277,7 @@ RingBuffer<T>::reset()
std::cerr << "RingBuffer<T>[" << this << "]::reset" << std::endl;
#endif
m_writer = 0;
m_reader = 0;
m_reader = m_writer;
}
template <typename T>
@@ -298,7 +306,7 @@ RingBuffer<T>::read(S *const R__ destination, int n)
if (n > available) {
std::cerr << "WARNING: RingBuffer::read: " << n << " requested, only "
<< available << " available" << std::endl;
v_zero(destination + available, n - available);
//!!! v_zero(destination + available, n - available);
n = available;
}
if (n == 0) return n;
@@ -367,7 +375,7 @@ RingBuffer<T>::readOne()
if (w == r) {
std::cerr << "WARNING: RingBuffer::readOne: no sample available"
<< std::endl;
return 0;
return T();
}
T value = m_buffer[r];

View File

@@ -1,15 +1,24 @@
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
Rubber Band
Rubber Band Library
An audio time-stretching and pitch-shifting library.
Copyright 2007-2011 Chris Cannam.
Copyright 2007-2012 Particular Programs Ltd.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
Alternatively, if you have a valid commercial licence for the
Rubber Band Library obtained by agreement with the copyright
holders, you may redistribute and/or modify it under the terms
described in that licence.
If you wish to distribute code using the Rubber Band Library
under terms other than those of the GNU General Public License,
you must obtain a valid commercial licence before doing so.
*/
#ifndef _RUBBERBAND_SCAVENGER_H_