summaryrefslogtreecommitdiffstats
path: root/src/sound/plugins/oalsound/test
diff options
context:
space:
mode:
authorerihel <erihel@gmail.com>2012-08-12 15:00:37 +0200
committererihel <erihel@gmail.com>2012-08-12 15:00:37 +0200
commit5e271e550dbb88f0bbea5f46aad9f0fd1d750eb3 (patch)
treed0e4c7bb68a6b07019574b5621fb086e8a07557c /src/sound/plugins/oalsound/test
parent9946459c0cd65c3b66719a2aefc42c7ab2a29c04 (diff)
downloadcolobot-5e271e550dbb88f0bbea5f46aad9f0fd1d750eb3.tar.gz
colobot-5e271e550dbb88f0bbea5f46aad9f0fd1d750eb3.tar.bz2
colobot-5e271e550dbb88f0bbea5f46aad9f0fd1d750eb3.zip
* New CPluginManager class for managing plugins based on colobot.ini
* Moved sound plugin into sound dir * Minor changes in logger and profile
Diffstat (limited to 'src/sound/plugins/oalsound/test')
-rw-r--r--src/sound/plugins/oalsound/test/CMakeLists.txt11
-rw-r--r--src/sound/plugins/oalsound/test/plugin_test.cpp40
2 files changed, 51 insertions, 0 deletions
diff --git a/src/sound/plugins/oalsound/test/CMakeLists.txt b/src/sound/plugins/oalsound/test/CMakeLists.txt
new file mode 100644
index 0000000..d10169b
--- /dev/null
+++ b/src/sound/plugins/oalsound/test/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required(VERSION 2.8)
+
+set(CMAKE_BUILD_TYPE debug)
+set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0 -std=c++11 -rdynamic")
+
+add_executable(plugin_test plugin_test.cpp ../../../../common/iman.cpp ../../../../common/logger.cpp ../../../../plugins/pluginloader.cpp)
+
+include_directories(".")
+include_directories("../../../../")
+
+target_link_libraries(plugin_test ltdl)
diff --git a/src/sound/plugins/oalsound/test/plugin_test.cpp b/src/sound/plugins/oalsound/test/plugin_test.cpp
new file mode 100644
index 0000000..40c1cd2
--- /dev/null
+++ b/src/sound/plugins/oalsound/test/plugin_test.cpp
@@ -0,0 +1,40 @@
+#include <string>
+#include <cstdio>
+#include <unistd.h>
+
+#include <common/logger.h>
+#include <common/iman.h>
+#include <sound/sound.h>
+#include <plugins/pluginloader.h>
+
+
+int main() {
+ new CLogger();
+ new CInstanceManager();
+
+ lt_dlinit();
+
+ CPluginLoader *plugin = new CPluginLoader("libopenalsound");
+ if (plugin->LoadPlugin()) {
+ CSoundInterface *sound = static_cast<CSoundInterface*>(CInstanceManager::GetInstancePointer()->SearchInstance(CLASS_SOUND));
+
+ sound->Create(true);
+ sound->CacheAll();
+ sound->Play((Sound)8);
+ sound->Play((Sound)18);
+
+ sleep(10);
+ /*
+ while (1)
+ {
+ // just a test, very slow
+ plugin->FrameMove(0);
+ //if ('n' == getchar())
+ // break;
+ }*/
+ plugin->UnloadPlugin();
+ }
+
+ lt_dlexit();
+ return 0;
+}