diff options
author | erihel <erihel@gmail.com> | 2012-07-19 19:19:21 +0200 |
---|---|---|
committer | erihel <erihel@gmail.com> | 2012-07-19 19:19:21 +0200 |
commit | d56db5f4e4a8e0d572bf3d682619bb25aebe4120 (patch) | |
tree | bb670182f3273a5a3bb18969cf8f25023fa381f0 /src/plugins/sound | |
parent | 0e4b070b5f10c0004cfbfa234e3634357b070cba (diff) | |
download | colobot-d56db5f4e4a8e0d572bf3d682619bb25aebe4120.tar.gz colobot-d56db5f4e4a8e0d572bf3d682619bb25aebe4120.tar.bz2 colobot-d56db5f4e4a8e0d572bf3d682619bb25aebe4120.zip |
* Chaned plugin interface
* Added plugin class for plugin loading
* Added plugin loading test
Diffstat (limited to 'src/plugins/sound')
-rw-r--r-- | src/plugins/sound/oalsound/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/plugins/sound/oalsound/alsound.cpp | 20 | ||||
-rw-r--r-- | src/plugins/sound/oalsound/alsound.h | 2 |
3 files changed, 20 insertions, 5 deletions
diff --git a/src/plugins/sound/oalsound/CMakeLists.txt b/src/plugins/sound/oalsound/CMakeLists.txt index 6056590..e36f3ac 100644 --- a/src/plugins/sound/oalsound/CMakeLists.txt +++ b/src/plugins/sound/oalsound/CMakeLists.txt @@ -4,10 +4,9 @@ set(SOURCES alsound.cpp buffer.cpp channel.cpp - ../../../common/logger.cpp ) -SET (CMAKE_CXX_FLAGS "-Wall -g -std=c++0x") +SET (CMAKE_CXX_FLAGS "-Wall -g -std=c++0x -fPIC") include(FindPkgConfig) include(FindOpenAL) diff --git a/src/plugins/sound/oalsound/alsound.cpp b/src/plugins/sound/oalsound/alsound.cpp index 0e15a40..19da66a 100644 --- a/src/plugins/sound/oalsound/alsound.cpp +++ b/src/plugins/sound/oalsound/alsound.cpp @@ -1,6 +1,6 @@ // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ #define MIN(a, b) (a > b ? b : a)
-PLUGIN_INTERFACE(ALSound, CSoundInterface)
+PLUGIN_INTERFACE(ALSound)
char* ALSound::PluginName()
@@ -39,6 +39,19 @@ int ALSound::PluginVersion() }
+void ALSound::InstallPlugin()
+{
+ CInstanceManager::GetInstancePointer()->AddInstance(CLASS_SOUND, this);
+}
+
+
+void ALSound::UninstallPlugin()
+{
+ CInstanceManager::GetInstancePointer()->DeleteInstance(CLASS_SOUND, this);
+ CleanUp();
+}
+
+
ALSound::ALSound()
{
mEnabled = false;
@@ -58,11 +71,12 @@ void ALSound::CleanUp() {
if (mEnabled) {
GetLogger()->Info("Unloading files and closing device...\n");
- mEnabled = false;
+ StopAll();
for (auto item : mSounds)
delete item.second;
+ mEnabled = false;
alutExit();
}
}
diff --git a/src/plugins/sound/oalsound/alsound.h b/src/plugins/sound/oalsound/alsound.h index 982d3a3..6d4e5b6 100644 --- a/src/plugins/sound/oalsound/alsound.h +++ b/src/plugins/sound/oalsound/alsound.h @@ -76,6 +76,8 @@ class ALSound : public CSoundInterface // plugin interface
char* PluginName();
int PluginVersion();
+ void InstallPlugin();
+ void UninstallPlugin();
private:
void CleanUp();
|