From 7028cbe09c688437910a25623098762bf0fa592d Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 28 Mar 2016 22:28:34 +1000 Subject: Move Irrlicht to src/others. --- .../examples/21.Quake3Explorer/sound.cpp | 98 ---------------------- 1 file changed, 98 deletions(-) delete mode 100644 libraries/irrlicht-1.8.1/examples/21.Quake3Explorer/sound.cpp (limited to 'libraries/irrlicht-1.8.1/examples/21.Quake3Explorer/sound.cpp') diff --git a/libraries/irrlicht-1.8.1/examples/21.Quake3Explorer/sound.cpp b/libraries/irrlicht-1.8.1/examples/21.Quake3Explorer/sound.cpp deleted file mode 100644 index 75615c1..0000000 --- a/libraries/irrlicht-1.8.1/examples/21.Quake3Explorer/sound.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/*! - Sound Factory. - provides a sound interface - -*/ - -#include "sound.h" - - -//#define USE_IRRKLANG - -#ifdef USE_IRRKLANG - -#include -#ifdef _IRR_WINDOWS_ - #pragma comment (lib, "irrKlang.lib") -#endif - -using namespace irrklang; - -struct soundfile: public IFileReader -{ - soundfile ( io::IReadFile* f ): file (f ) {} - virtual ~soundfile () { file->drop (); } - - virtual ik_s32 read(void* buffer, ik_u32 sizeToRead) { return file->read ( buffer, sizeToRead ); } - virtual bool seek(ik_s32 finalPos, bool relativeMovement = false) { return file->seek ( finalPos, relativeMovement ); } - virtual ik_s32 getSize(){ return file->getSize (); } - virtual ik_s32 getPos() {return file->getPos (); } - virtual const ik_c8* getFileName() { return file->getFileName (); } - io::IReadFile* file; -}; - -struct klangFactory : public irrklang::IFileFactory -{ - klangFactory ( IrrlichtDevice *device ) { Device = device; } - - virtual irrklang::IFileReader* createFileReader(const ik_c8* filename) - { - io::IReadFile* file = Device->getFileSystem()->createAndOpenFile(filename); - if ( 0 == file ) - return 0; - - return new soundfile ( file ); - } - - IrrlichtDevice *Device; -}; - -ISoundEngine *engine = 0; -ISound *backMusic = 0; - -void sound_init ( IrrlichtDevice *device ) -{ - engine = createIrrKlangDevice (); - if ( 0 == engine ) - return; - - klangFactory *f = new klangFactory ( device ); - engine->addFileFactory ( f ); -} - -void sound_shutdown () -{ - if ( backMusic ) - backMusic->drop (); - - if ( engine ) - engine->drop (); -} - -void background_music ( const c8 * file ) -{ - if ( 0 == engine ) - return; - - if ( backMusic ) - { - backMusic->stop (); - backMusic->drop (); - } - - backMusic = engine->play2D ( file, true, false, true ); - - if ( backMusic ) - { - backMusic->setVolume ( 0.5f ); - } -} - -#else - -void sound_init ( IrrlichtDevice *device ) {} -void sound_shutdown () {} -void background_music ( const c8 * file ) {} - -#endif - -- cgit v1.1