summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-05-06 16:33:10 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2017-05-06 16:33:10 +0200
commit286cddccfd9d69f4bc567fc9f00898f06315cd30 (patch)
tree22ea704d16653483a972d8b16e0c8724c3d28828
parenta1f4e968563763435027a905be8349cda1974e00 (diff)
Get rid of unused unistd includes. Change the rest of the sleep calls to c++.
-rw-r--r--drumgizmo/drumgizmoc.cc15
-rw-r--r--plugingui/directory.cc4
-rw-r--r--plugingui/directory.h1
-rw-r--r--plugingui/filebrowser.cc1
-rw-r--r--src/audiofile.cc5
-rw-r--r--src/configfile.cc1
-rw-r--r--src/sample.cc3
-rw-r--r--test/audiocachetest.cc6
-rw-r--r--test/dgreftest/dgreftest.cc5
-rw-r--r--test/enginetest.cc12
-rw-r--r--test/lv2.cc13
-rw-r--r--test/resampler.cc1
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 <string.h>
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
#include <sstream>
#include <chrono>
#include <thread>
@@ -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 <http://www.gnu.org/licenses/gpl.html>.\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 <http://www.gnu.org/licenses/gpl.html>.\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 <algorithm>
#include <vector>
#include <string.h>
+#include <unistd.h>
#include <platform.h>
@@ -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 <sys/types.h>
#include <sys/stat.h>
-#include <unistd.h>
#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 <sys/types.h>
#include <sys/stat.h>
-#include <unistd.h>
#include <platform.h>
#include <hugin.hpp>
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 <cassert>
-
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-
#include <sndfile.h>
#include <config.h>
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 <errno.h>
#include <string.h>
#include <stdlib.h>
-#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
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 <stdlib.h>
-#include <unistd.h>
-
#include <sndfile.h>
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 <cppunit/extensions/HelperMacros.h>
+#include <thread>
+#include <chrono>
+
#include <audiofile.h>
#include <audiocache.h>
#include <settings.h>
-#include <unistd.h>
#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 <string>
#include <iostream>
#include <cassert>
-#include <unistd.h>
+#include <thread>
+#include <chrono>
#include <sys/types.h>
#include <sys/stat.h>
@@ -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 <cppunit/extensions/HelperMacros.h>
+#include <thread>
+#include <chrono>
+
#include <drumgizmo.h>
-#include <unistd.h>
#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 <cppunit/extensions/HelperMacros.h>
-#include <unistd.h>
+#include <thread>
+#include <chrono>
#include <memory.h>
#include <stdio.h>
#include <arpa/inet.h>
@@ -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 <cppunit/extensions/HelperMacros.h>
#include "../src/chresampler.h"
-#include <unistd.h>
#define BUFSZ 500