Minor and mostly immaterial bits

This commit is contained in:
Chris Cannam
2011-12-09 18:18:32 +00:00
parent ec85a7c8c8
commit 4ecb1fa6f1
7 changed files with 22 additions and 22 deletions

View File

@@ -1220,7 +1220,6 @@ RubberBandStretcher::Impl::process(const float *const *input, size_t samples, bo
} }
} }
if (m_threaded) { if (m_threaded) {
MutexLocker locker(&m_threadSetMutex); MutexLocker locker(&m_threadSetMutex);
@@ -1247,12 +1246,6 @@ RubberBandStretcher::Impl::process(const float *const *input, size_t samples, bo
while (!allConsumed) { while (!allConsumed) {
//#ifndef NO_THREADING
// if (m_threaded) {
// pthread_mutex_lock(&m_inputProcessedMutex);
// }
//#endif
// In a threaded mode, our "consumed" counters only indicate // In a threaded mode, our "consumed" counters only indicate
// the number of samples that have been taken into the input // the number of samples that have been taken into the input
// ring buffers waiting to be processed by the process thread. // ring buffers waiting to be processed by the process thread.
@@ -1276,7 +1269,9 @@ RubberBandStretcher::Impl::process(const float *const *input, size_t samples, bo
} }
// cerr << "process: happy with channel " << c << endl; // cerr << "process: happy with channel " << c << endl;
} }
if (!m_threaded && !m_realtime) { if (
!m_threaded &&
!m_realtime) {
bool any = false, last = false; bool any = false, last = false;
processChunks(c, any, last); processChunks(c, any, last);
} }
@@ -1289,7 +1284,6 @@ RubberBandStretcher::Impl::process(const float *const *input, size_t samples, bo
// the realtime onset detector // the realtime onset detector
processOneChunk(); processOneChunk();
} }
if (m_threaded) { if (m_threaded) {
for (ThreadSet::iterator i = m_threadSet.begin(); for (ThreadSet::iterator i = m_threadSet.begin();
i != m_threadSet.end(); ++i) { i != m_threadSet.end(); ++i) {
@@ -1300,16 +1294,6 @@ RubberBandStretcher::Impl::process(const float *const *input, size_t samples, bo
m_spaceAvailable.wait(500); m_spaceAvailable.wait(500);
} }
m_spaceAvailable.unlock(); m_spaceAvailable.unlock();
/*
} else {
if (!allConsumed) {
cerr << "RubberBandStretcher::Impl::process: ERROR: Too much data provided to process() call -- either call setMaxProcessSize() beforehand, or provide only getSamplesRequired() frames at a time" << endl;
for (size_t c = 0; c < m_channels; ++c) {
cerr << "channel " << c << ": " << samples << " provided, " << consumed[c] << " consumed" << endl;
}
// break;
}
*/
} }
if (m_debugLevel > 2) { if (m_debugLevel > 2) {

View File

@@ -160,8 +160,9 @@ protected:
size_t m_maxProcessSize; size_t m_maxProcessSize;
size_t m_expectedInputDuration; size_t m_expectedInputDuration;
bool m_threaded; bool m_threaded;
bool m_realtime; bool m_realtime;
Options m_options; Options m_options;
int m_debugLevel; int m_debugLevel;

View File

@@ -42,6 +42,7 @@ using std::endl;
namespace RubberBand { namespace RubberBand {
RubberBandStretcher::Impl::ProcessThread::ProcessThread(Impl *s, size_t c) : RubberBandStretcher::Impl::ProcessThread::ProcessThread(Impl *s, size_t c) :
m_s(s), m_s(s),
m_channel(c), m_channel(c),
@@ -116,6 +117,7 @@ RubberBandStretcher::Impl::ProcessThread::abandon()
m_abandoning = true; m_abandoning = true;
} }
bool bool
RubberBandStretcher::Impl::resampleBeforeStretching() const RubberBandStretcher::Impl::resampleBeforeStretching() const
{ {
@@ -377,6 +379,7 @@ RubberBandStretcher::Impl::testInbufReadSpace(size_t c)
<< inbuf.getReadSpace() << " < " << m_aWindowSize << inbuf.getReadSpace() << " < " << m_aWindowSize
<< ") when not all input written, on processChunks for channel " << c << endl; << ") when not all input written, on processChunks for channel " << c << endl;
} }
} }
return false; return false;
} }

View File

@@ -12,6 +12,7 @@
COPYING included with this distribution for more information. COPYING included with this distribution for more information.
*/ */
#include "Thread.h" #include "Thread.h"
#include <iostream> #include <iostream>

View File

@@ -15,14 +15,15 @@
#ifndef _RUBBERBAND_THREAD_H_ #ifndef _RUBBERBAND_THREAD_H_
#define _RUBBERBAND_THREAD_H_ #define _RUBBERBAND_THREAD_H_
#include <string>
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#else /* !_WIN32 */ #else /* !_WIN32 */
#include <pthread.h> #include <pthread.h>
#endif /* !_WIN32 */ #endif /* !_WIN32 */
#include <string>
//#define DEBUG_THREAD 1 //#define DEBUG_THREAD 1
//#define DEBUG_MUTEX 1 //#define DEBUG_MUTEX 1
//#define DEBUG_CONDITION 1 //#define DEBUG_CONDITION 1
@@ -143,4 +144,5 @@ private:
} }
#endif #endif

View File

@@ -26,6 +26,13 @@ inline void c_phasor(T *real, T *imag, T phase)
{ {
//!!! IPP contains ippsSinCos_xxx in ippvm.h -- these are //!!! IPP contains ippsSinCos_xxx in ippvm.h -- these are
//!!! fixed-accuracy, test and compare //!!! fixed-accuracy, test and compare
#if defined __GNUC__
if (sizeof(T) == sizeof(float)) {
sincosf(phase, (float *)imag, (float *)real);
} else {
sincos(phase, (double *)imag, (double *)real);
}
#else
if (sizeof(T) == sizeof(float)) { if (sizeof(T) == sizeof(float)) {
*real = cosf(phase); *real = cosf(phase);
*imag = sinf(phase); *imag = sinf(phase);
@@ -33,6 +40,7 @@ inline void c_phasor(T *real, T *imag, T phase)
*real = cos(phase); *real = cos(phase);
*imag = sin(phase); *imag = sin(phase);
} }
#endif
} }
template<typename T> template<typename T>

View File

@@ -125,4 +125,5 @@ extern void system_memorybarrier();
#endif #endif
#endif #endif