From 286cddccfd9d69f4bc567fc9f00898f06315cd30 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 6 May 2017 16:33:10 +0200 Subject: Get rid of unused unistd includes. Change the rest of the sleep calls to c++. --- drumgizmo/drumgizmoc.cc | 15 +++++++-------- plugingui/directory.cc | 4 +++- plugingui/directory.h | 1 - plugingui/filebrowser.cc | 1 - src/audiofile.cc | 5 ----- src/configfile.cc | 1 - src/sample.cc | 3 --- test/audiocachetest.cc | 6 ++++-- test/dgreftest/dgreftest.cc | 5 +++-- test/enginetest.cc | 12 +++++++----- test/lv2.cc | 13 +++++++------ test/resampler.cc | 1 - 12 files changed, 31 insertions(+), 36 deletions(-) diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc index 22313c0..a3df3f7 100644 --- a/drumgizmo/drumgizmoc.cc +++ b/drumgizmo/drumgizmoc.cc @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -49,13 +48,13 @@ static const char version_str[] = "DrumGizmo v" VERSION "\n"; static const char copyright_str[] = - "Copyright (C) 2008-2011 Bent Bisballe Nyeng - Aasimon.org.\n" - "This is free software. You may redistribute copies of it under the terms " - "of\n" - "the GNU Lesser General Public License .\n" - "There is NO WARRANTY, to the extent permitted by law.\n" - "\n" - "Written by Bent Bisballe Nyeng (deva@aasimon.org)\n"; + "Copyright (C) 2008-2011 Bent Bisballe Nyeng - Aasimon.org.\n" + "This is free software. You may redistribute copies of it under the terms " + "of\n" + "the GNU Lesser General Public License .\n" + "There is NO WARRANTY, to the extent permitted by law.\n" + "\n" + "Written by Bent Bisballe Nyeng (deva@aasimon.org)\n"; static const char usage_str[] = "Usage: %s [options] drumkitfile\n" diff --git a/plugingui/directory.cc b/plugingui/directory.cc index 96ed5b7..083c8e4 100644 --- a/plugingui/directory.cc +++ b/plugingui/directory.cc @@ -32,6 +32,7 @@ #include #include #include +#include #include @@ -51,7 +52,8 @@ #define SEP "/" #endif -namespace GUI { +namespace GUI +{ Directory::Directory(std::string path) { diff --git a/plugingui/directory.h b/plugingui/directory.h index 1acc0bf..100204a 100644 --- a/plugingui/directory.h +++ b/plugingui/directory.h @@ -33,7 +33,6 @@ #include #include -#include #define DIRECTORY_HIDDEN 1 diff --git a/plugingui/filebrowser.cc b/plugingui/filebrowser.cc index 62f7775..8854f6e 100644 --- a/plugingui/filebrowser.cc +++ b/plugingui/filebrowser.cc @@ -37,7 +37,6 @@ #include #include -#include #include #include diff --git a/src/audiofile.cc b/src/audiofile.cc index 3fe854b..e274e61 100644 --- a/src/audiofile.cc +++ b/src/audiofile.cc @@ -29,11 +29,6 @@ #include "audiofile.h" #include - -#include -#include -#include - #include #include diff --git a/src/configfile.cc b/src/configfile.cc index 71496a0..731d3aa 100644 --- a/src/configfile.cc +++ b/src/configfile.cc @@ -30,7 +30,6 @@ #include #include #include -#include #include #include diff --git a/src/sample.cc b/src/sample.cc index ced8a47..9d28a17 100644 --- a/src/sample.cc +++ b/src/sample.cc @@ -26,9 +26,6 @@ */ #include "sample.h" -#include -#include - #include Sample::Sample(const std::string& name, float power) diff --git a/test/audiocachetest.cc b/test/audiocachetest.cc index 0e3db10..c03bee4 100644 --- a/test/audiocachetest.cc +++ b/test/audiocachetest.cc @@ -26,10 +26,12 @@ */ #include +#include +#include + #include #include #include -#include #include "drumkit_creator.h" @@ -108,7 +110,7 @@ public: int timeout = 1000; while(!audio_cache.isReady(id)) { - usleep(1000); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); if(--timeout == 0) { CPPUNIT_ASSERT(false); // timeout diff --git a/test/dgreftest/dgreftest.cc b/test/dgreftest/dgreftest.cc index f9eef03..ea38091 100644 --- a/test/dgreftest/dgreftest.cc +++ b/test/dgreftest/dgreftest.cc @@ -29,7 +29,8 @@ #include #include #include -#include +#include +#include #include #include @@ -99,7 +100,7 @@ int main(int argc, char* argv[]) while(settings.drumkit_load_status.load() != LoadStatus::Done) { - usleep(10000); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); int total = settings.number_of_files.load(); int loaded = settings.number_of_files_loaded.load(); diff --git a/test/enginetest.cc b/test/enginetest.cc index 5e33fe2..ad4315d 100644 --- a/test/enginetest.cc +++ b/test/enginetest.cc @@ -26,8 +26,10 @@ */ #include +#include +#include + #include -#include #include "drumkit_creator.h" @@ -100,18 +102,18 @@ public: for(int i = 0; i < 100; ++i) { settings.drumkit_file.store(kit1_file); - usleep(100); + std::this_thread::sleep_for(std::chrono::microseconds(100)); settings.drumkit_file.store(kit2_file); - usleep(100); + std::this_thread::sleep_for(std::chrono::microseconds(100)); } // Switch kits with bigger delay giving the loader time to finish for(int i = 0; i < 100; ++i) { settings.drumkit_file.store(kit1_file); - usleep(10000); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); settings.drumkit_file.store(kit2_file); - usleep(10000); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); } } }; diff --git a/test/lv2.cc b/test/lv2.cc index 78bf342..4fd197e 100644 --- a/test/lv2.cc +++ b/test/lv2.cc @@ -26,7 +26,8 @@ */ #include -#include +#include +#include #include #include #include @@ -139,7 +140,7 @@ public: // run for 1 samples to trigger kit loading res = h.run(1); CPPUNIT_ASSERT_EQUAL(0, res); - usleep(1000); // wait for kit to get loaded (async), + std::this_thread::sleep_for(std::chrono::milliseconds(1)); // wait for kit to get loaded (async), res = h.run(100); CPPUNIT_ASSERT_EQUAL(0, res); @@ -217,7 +218,7 @@ public: // run for 1 samples to trigger kit loading res = h.run(1); CPPUNIT_ASSERT_EQUAL(0, res); - usleep(1000); // wait for kit to get loaded (async), + std::this_thread::sleep_for(std::chrono::milliseconds(1)); // wait for kit to get loaded (async), seq.addMidiNote(5, 1, 127); res = h.run(100); @@ -307,13 +308,13 @@ public: // run for 1 samples to trigger kit loading res = h.run(1); CPPUNIT_ASSERT_EQUAL(0, res); - sleep(1); // wait for kit to get loaded (async), + std::this_thread::sleep_for(std::chrono::seconds(1)); // wait for kit to get loaded (async), seq.addMidiNote(5, 1, 127); for(int i = 0; i < 10; i++) { res = h.run(10); - usleep(1000); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); CPPUNIT_ASSERT_EQUAL(0, res); //printf("Iteration:\n"); @@ -330,7 +331,7 @@ public: seq.addMidiNote(5, 1, 127); res = h.run(10); - usleep(1000); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); CPPUNIT_ASSERT_EQUAL(0, res); /* diff --git a/test/resampler.cc b/test/resampler.cc index fa52cbf..2b6862d 100644 --- a/test/resampler.cc +++ b/test/resampler.cc @@ -27,7 +27,6 @@ #include #include "../src/chresampler.h" -#include #define BUFSZ 500 -- cgit v1.2.3