summaryrefslogtreecommitdiffstats
path: root/src/sound
diff options
context:
space:
mode:
authorerihel <erihel@gmail.com>2012-12-20 21:57:57 +0100
committererihel <erihel@gmail.com>2012-12-20 21:57:57 +0100
commitf0e76ad446e58ea9b1564517fc3a823e61fd7410 (patch)
treeeddefe26b736243946ac1ce962aa9a45e800c9b7 /src/sound
parenta6ff654ae37ca372d785c1e155fbfe67a3a25fed (diff)
downloadcolobot-f0e76ad446e58ea9b1564517fc3a823e61fd7410.tar.gz
colobot-f0e76ad446e58ea9b1564517fc3a823e61fd7410.tar.bz2
colobot-f0e76ad446e58ea9b1564517fc3a823e61fd7410.zip
sound fix
Diffstat (limited to 'src/sound')
-rw-r--r--src/sound/oalsound/CMakeLists.txt24
-rw-r--r--src/sound/oalsound/alsound.cpp40
-rw-r--r--src/sound/oalsound/test/CMakeLists.txt14
-rw-r--r--src/sound/oalsound/test/plugin_test.cpp40
4 files changed, 6 insertions, 112 deletions
diff --git a/src/sound/oalsound/CMakeLists.txt b/src/sound/oalsound/CMakeLists.txt
deleted file mode 100644
index bb7e9ff..0000000
--- a/src/sound/oalsound/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-
-set(SOURCES
- alsound.cpp
- buffer.cpp
- channel.cpp
-)
-
-SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x -fPIC")
-SET (CMAKE_CXX_FLAGS_DEBUG "-g")
-
-include(FindPkgConfig)
-include(FindOpenAL)
-pkg_check_modules(OPENAL_LIB REQUIRED openal)
-
-set(OPENAL_LIBRARIES
- openal
- alut
-)
-
-include_directories(../../..)
-include_directories(.)
-add_library(openalsound SHARED ${SOURCES})
-target_link_libraries(openalsound ${OPENAL_LIBRARIES})
diff --git a/src/sound/oalsound/alsound.cpp b/src/sound/oalsound/alsound.cpp
index 83a4def..5f416da 100644
--- a/src/sound/oalsound/alsound.cpp
+++ b/src/sound/oalsound/alsound.cpp
@@ -23,51 +23,23 @@
#define MIN(a, b) (a > b ? b : a)
-
-PLUGIN_INTERFACE(ALSound)
-
-
-std::string ALSound::PluginName()
-{
- return "Sound plugin using OpenAL library to play sounds.";
-}
-
-
-int ALSound::PluginVersion()
-{
- return 2;
-}
-
-
-void ALSound::InstallPlugin()
-{
- auto pointer = CInstanceManager::GetInstancePointer();
- if (pointer != nullptr)
- CInstanceManager::GetInstancePointer()->AddInstance(CLASS_SOUND, this);
-}
-
-
-bool ALSound::UninstallPlugin(std::string &reason)
-{
- auto pointer = CInstanceManager::GetInstancePointer();
- if (pointer != nullptr)
- CInstanceManager::GetInstancePointer()->DeleteInstance(CLASS_SOUND, this);
- CleanUp();
- return true;
-}
-
-
ALSound::ALSound()
{
mEnabled = false;
m3D = false;
mAudioVolume = MAXVOLUME;
mMute = false;
+ auto pointer = CInstanceManager::GetInstancePointer();
+ if (pointer != nullptr)
+ CInstanceManager::GetInstancePointer()->AddInstance(CLASS_SOUND, this);
}
ALSound::~ALSound()
{
+ auto pointer = CInstanceManager::GetInstancePointer();
+ if (pointer != nullptr)
+ CInstanceManager::GetInstancePointer()->DeleteInstance(CLASS_SOUND, this);
CleanUp();
}
diff --git a/src/sound/oalsound/test/CMakeLists.txt b/src/sound/oalsound/test/CMakeLists.txt
deleted file mode 100644
index dd208ea..0000000
--- a/src/sound/oalsound/test/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-
-if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE debug)
-endif(NOT CMAKE_BUILD_TYPE)
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -rdynamic")
-set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
-
-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_LIBRARY})
diff --git a/src/sound/oalsound/test/plugin_test.cpp b/src/sound/oalsound/test/plugin_test.cpp
deleted file mode 100644
index 40c1cd2..0000000
--- a/src/sound/oalsound/test/plugin_test.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#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;
-}