forked from minetest/minetest
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
celeron55's sound system initial framework
- Loading branch information
Showing
12 changed files
with
548 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# - Find vorbis | ||
# Find the native vorbis includes and libraries | ||
# | ||
# VORBIS_INCLUDE_DIR - where to find vorbis.h, etc. | ||
# VORBIS_LIBRARIES - List of libraries when using vorbis(file). | ||
# VORBIS_FOUND - True if vorbis found. | ||
|
||
if(NOT GP2XWIZ) | ||
if(VORBIS_INCLUDE_DIR) | ||
# Already in cache, be silent | ||
set(VORBIS_FIND_QUIETLY TRUE) | ||
endif(VORBIS_INCLUDE_DIR) | ||
find_path(OGG_INCLUDE_DIR ogg/ogg.h) | ||
find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h) | ||
# MSVC built ogg/vorbis may be named ogg_static and vorbis_static | ||
find_library(OGG_LIBRARY NAMES ogg ogg_static) | ||
find_library(VORBIS_LIBRARY NAMES vorbis vorbis_static) | ||
find_library(VORBISFILE_LIBRARY NAMES vorbisfile vorbisfile_static) | ||
# Handle the QUIETLY and REQUIRED arguments and set VORBIS_FOUND | ||
# to TRUE if all listed variables are TRUE. | ||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(VORBIS DEFAULT_MSG | ||
OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR | ||
OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY) | ||
else(NOT GP2XWIZ) | ||
find_path(VORBIS_INCLUDE_DIR tremor/ivorbisfile.h) | ||
find_library(VORBIS_LIBRARY NAMES vorbis_dec) | ||
find_package_handle_standard_args(VORBIS DEFAULT_MSG | ||
VORBIS_INCLUDE_DIR VORBIS_LIBRARY) | ||
endif(NOT GP2XWIZ) | ||
|
||
if(VORBIS_FOUND) | ||
if(NOT GP2XWIZ) | ||
set(VORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} | ||
${OGG_LIBRARY}) | ||
else(NOT GP2XWIZ) | ||
set(VORBIS_LIBRARIES ${VORBIS_LIBRARY}) | ||
endif(NOT GP2XWIZ) | ||
else(VORBIS_FOUND) | ||
set(VORBIS_LIBRARIES) | ||
endif(VORBIS_FOUND) | ||
|
||
mark_as_advanced(OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR) | ||
mark_as_advanced(OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
Minetest-c55 | ||
Copyright (C) 2012 celeron55, Perttu Ahola <[email protected]> | ||
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 | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License along | ||
with this program; if not, write to the Free Software Foundation, Inc., | ||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
#include "sound.h" | ||
|
||
// Global DummySoundManager singleton | ||
DummySoundManager dummySoundManager; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
Minetest-c55 | ||
Copyright (C) 2012 celeron55, Perttu Ahola <[email protected]> | ||
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 | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License along | ||
with this program; if not, write to the Free Software Foundation, Inc., | ||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
#ifndef SOUND_HEADER | ||
#define SOUND_HEADER | ||
|
||
#include "irrlichttypes.h" | ||
#include <string> | ||
#include <vector> | ||
#include <set> | ||
|
||
class OnDemandSoundFetcher | ||
{ | ||
public: | ||
virtual void getSoundFilenames(const std::string &name, | ||
std::set<std::string> &dst); | ||
}; | ||
|
||
class ISoundManager | ||
{ | ||
public: | ||
virtual ~ISoundManager(){} | ||
|
||
// Multiple sounds can be loaded per name; when played, the sound | ||
// should be chosen randomly from alternatives | ||
// Return value determines success/failure | ||
virtual bool loadSound(const std::string &name, | ||
const std::string &filepath) = 0; | ||
virtual bool loadSound(const std::string &name, | ||
const std::vector<char> &filedata) = 0; | ||
|
||
virtual void updateListener(v3f pos, v3f vel, v3f at, v3f up) = 0; | ||
// playSound functions return -1 on failure, otherwise a handle to the | ||
// sound | ||
virtual int playSound(const std::string &name, int loopcount, | ||
float volume) = 0; | ||
virtual int playSoundAt(const std::string &name, int loopcount, | ||
v3f pos, float volume) = 0; | ||
virtual void stopSound(int sound) = 0; | ||
}; | ||
|
||
class DummySoundManager: public ISoundManager | ||
{ | ||
public: | ||
virtual bool loadSound(const std::string &name, | ||
const std::string &filepath) {return true;} | ||
virtual bool loadSound(const std::string &name, | ||
const std::vector<char> &filedata) {return true;} | ||
void updateListener(v3f pos, v3f vel, v3f at, v3f up) {} | ||
int playSound(const std::string &name, int loopcount, | ||
float volume) {return 0;} | ||
int playSoundAt(const std::string &name, int loopcount, | ||
v3f pos, float volume) {return 0;} | ||
void stopSound(int sound) {} | ||
}; | ||
|
||
// Global DummySoundManager singleton | ||
extern DummySoundManager dummySoundManager; | ||
|
||
#endif | ||
|
Oops, something went wrong.