comparison src/Silvet.cpp @ 356:7dcff010d9cd

Some tidying, switch to libc++
author Chris Cannam
date Mon, 07 Sep 2015 14:45:19 +0100
parents a3fc6e1f2d4e
children 0af00da90a40
comparison
equal deleted inserted replaced
355:50fde8eecba5 356:7dcff010d9cd
22 #include "constant-q-cpp/src/dsp/Resampler.h" 22 #include "constant-q-cpp/src/dsp/Resampler.h"
23 #include "flattendynamics-ladspa.h" 23 #include "flattendynamics-ladspa.h"
24 #include "LiveInstruments.h" 24 #include "LiveInstruments.h"
25 25
26 #include <vector> 26 #include <vector>
27
28 #include <cstdio>
29
30 #if (defined(MAX_EM_THREADS) && (MAX_EM_THREADS > 1))
27 #include <future> 31 #include <future>
28 32 using std::future;
29 #include <cstdio> 33 using std::async;
34 #endif
30 35
31 using std::vector; 36 using std::vector;
32 using std::cout; 37 using std::cout;
33 using std::cerr; 38 using std::cerr;
34 using std::endl; 39 using std::endl;
35 using std::pair; 40 using std::pair;
36 using std::future; 41
37 using std::async;
38 using Vamp::RealTime; 42 using Vamp::RealTime;
39 43
40 static int processingSampleRate = 44100; 44 static int processingSampleRate = 44100;
41 45
42 static int binsPerSemitoneLive = 1; 46 static int binsPerSemitoneLive = 1;
725 vector<vector<int> > localBestShifts; 729 vector<vector<int> > localBestShifts;
726 if (wantShifts) { 730 if (wantShifts) {
727 localBestShifts = vector<vector<int> >(width); 731 localBestShifts = vector<vector<int> >(width);
728 } 732 }
729 733
730 int emThreadCount = MAX_EM_THREADS; 734 int emThreadCount = 1;
735
736 #if (defined(MAX_EM_THREADS) && (MAX_EM_THREADS > 1))
737 emThreadCount = MAX_EM_THREADS;
738
731 if (emThreadCount > int(std::thread::hardware_concurrency())) { 739 if (emThreadCount > int(std::thread::hardware_concurrency())) {
732 emThreadCount = std::thread::hardware_concurrency(); 740 emThreadCount = std::thread::hardware_concurrency();
733 } 741 }
734 if (m_mode == LiveMode && pack.templates.size() == 1) { 742 if (m_mode == LiveMode && pack.templates.size() == 1) {
735 // The EM step is probably not slow enough to merit it 743 // The EM step is probably not slow enough to merit it
736 emThreadCount = 1; 744 emThreadCount = 1;
737 } 745 }
738 746
739 #if (defined(MAX_EM_THREADS) && (MAX_EM_THREADS > 1))
740 if (emThreadCount > 1) { 747 if (emThreadCount > 1) {
741 for (int i = 0; i < width; ) { 748 for (int i = 0; i < width; ) {
742 typedef future<pair<vector<double>, vector<int>>> EMFuture; 749 typedef future<pair<vector<double>, vector<int>>> EMFuture;
743 vector<EMFuture> results; 750 vector<EMFuture> results;
744 for (int j = 0; j < emThreadCount && i + j < width; ++j) { 751 for (int j = 0; j < emThreadCount && i + j < width; ++j) {