* Add OptionThreadingAlways
This commit is contained in:
@@ -122,10 +122,15 @@ public:
|
||||
*
|
||||
* OptionThreadingAuto - Permit the stretcher to determine its
|
||||
* own threading model. Usually this means using one processing
|
||||
* thread per audio channel in offline mode, and one thread only
|
||||
* in realtime mode.
|
||||
* thread per audio channel in offline mode if the stretcher is
|
||||
* able to determine that more than one CPU is available, and
|
||||
* one thread only in realtime mode.
|
||||
*
|
||||
* OptionThreadingNone - Never use more than one thread.
|
||||
* OptionThreadingNever - Never use more than one thread.
|
||||
*
|
||||
* OptionThreadingAlways - Use multiple threads in any situation
|
||||
* where OptionThreadingAuto would do so, except omit the check
|
||||
* for multiple CPUs and instead assume it to be true.
|
||||
*
|
||||
* 6. Options prefixed OptionWindow control the window size for
|
||||
* FFT processing. The window size actually used will depend on
|
||||
@@ -162,7 +167,8 @@ public:
|
||||
static const int OptionPhaseIndependent = 0x00002000;
|
||||
|
||||
static const int OptionThreadingAuto = 0x00000000;
|
||||
static const int OptionThreadingNone = 0x00010000;
|
||||
static const int OptionThreadingNever = 0x00010000;
|
||||
static const int OptionThreadingAlways = 0x00020000;
|
||||
|
||||
static const int OptionWindowStandard = 0x00000000;
|
||||
static const int OptionWindowShort = 0x00100000;
|
||||
|
||||
@@ -119,16 +119,19 @@ RubberBandStretcher::Impl::Impl(RubberBandStretcher *stretcher,
|
||||
|
||||
if (m_channels > 1) {
|
||||
|
||||
if (!m_realtime &&
|
||||
!(m_options & OptionThreadingNone) &&
|
||||
Thread::threadingAvailable() &&
|
||||
system_is_multiprocessor()) {
|
||||
m_threaded = true;
|
||||
|
||||
m_threaded = true;
|
||||
if (m_realtime) {
|
||||
m_threaded = false;
|
||||
} else if (m_options & OptionThreadingNever) {
|
||||
m_threaded = false;
|
||||
} else if (!(m_options & OptionThreadingAlways) &&
|
||||
!system_is_multiprocessor()) {
|
||||
m_threaded = false;
|
||||
}
|
||||
|
||||
if (m_debugLevel > 0) {
|
||||
cerr << "Going multithreaded..." << endl;
|
||||
}
|
||||
if (m_threaded && m_debugLevel > 0) {
|
||||
cerr << "Going multithreaded..." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
22
src/main.cpp
22
src/main.cpp
@@ -38,7 +38,7 @@ int main(int argc, char **argv)
|
||||
int debug = 0;
|
||||
bool realtime = false;
|
||||
bool precise = false;
|
||||
bool threaded = true;
|
||||
int threading = 0;
|
||||
bool peaklock = true;
|
||||
bool longwin = false;
|
||||
bool shortwin = false;
|
||||
@@ -83,6 +83,7 @@ int main(int argc, char **argv)
|
||||
{ "thresh2", 1, 0, '7' },
|
||||
{ "bl-transients", 0, 0, '8' },
|
||||
{ "no-softening", 0, 0, '9' },
|
||||
{ "threads", 0, 0, '@' },
|
||||
{ "quiet", 0, 0, 'q' },
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
@@ -99,7 +100,8 @@ int main(int argc, char **argv)
|
||||
case 'd': debug = atoi(optarg); break;
|
||||
case 'R': realtime = true; break;
|
||||
case 'P': precise = true; break;
|
||||
case '0': threaded = false; 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;
|
||||
@@ -143,7 +145,8 @@ int main(int argc, char **argv)
|
||||
cerr << endl;
|
||||
cerr << " -P, --precise Aim for minimal time distortion (implied by -R)" << endl;
|
||||
cerr << " -R, --realtime Select realtime mode (implies -P --no-threads)" << endl;
|
||||
cerr << " --no-threads No extra threads regardless of cpus/channel count" << endl;
|
||||
cerr << " --no-threads No extra threads regardless of CPU and channel count" << endl;
|
||||
cerr << " --threads Assume multi-CPU even if only one CPU is identified" << endl;
|
||||
cerr << " --no-transients Disable phase resynchronisation at transients" << endl;
|
||||
cerr << " --bl-transients Band-limit phase resync to extreme frequencies" << endl;
|
||||
cerr << " --no-peaklock Disable phase locking to peak frequencies" << endl;
|
||||
@@ -217,10 +220,21 @@ int main(int argc, char **argv)
|
||||
if (precise) options |= RubberBandStretcher::OptionStretchPrecise;
|
||||
if (!peaklock) options |= RubberBandStretcher::OptionPhaseIndependent;
|
||||
if (!softening) options |= RubberBandStretcher::OptionPhasePeakLocked;
|
||||
if (!threaded) options |= RubberBandStretcher::OptionThreadingNone;
|
||||
if (longwin) options |= RubberBandStretcher::OptionWindowLong;
|
||||
if (shortwin) options |= RubberBandStretcher::OptionWindowShort;
|
||||
|
||||
switch (threading) {
|
||||
case 0:
|
||||
options |= RubberBandStretcher::OptionThreadingAuto;
|
||||
break;
|
||||
case 1:
|
||||
options |= RubberBandStretcher::OptionThreadingNever;
|
||||
break;
|
||||
case 2:
|
||||
options |= RubberBandStretcher::OptionThreadingAlways;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (transients) {
|
||||
case NoTransients:
|
||||
options |= RubberBandStretcher::OptionTransientsSmooth;
|
||||
|
||||
Reference in New Issue
Block a user