2009-04-16 14:14:13 +03:00
|
|
|
#ifndef __CMUSICHANDLER_H__
|
|
|
|
#define __CMUSICHANDLER_H__
|
|
|
|
|
2009-04-22 21:48:56 +03:00
|
|
|
#include "CSoundBase.h"
|
2009-04-16 14:14:13 +03:00
|
|
|
|
2009-04-15 17:03:31 +03:00
|
|
|
/*
|
|
|
|
* CMusicHandler.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
2009-04-16 14:14:13 +03:00
|
|
|
*/
|
|
|
|
|
2009-04-22 21:48:56 +03:00
|
|
|
struct Mix_Chunk;
|
|
|
|
class CSndHandler;
|
|
|
|
|
2009-04-16 14:14:13 +03:00
|
|
|
class CMusicHandler
|
|
|
|
{
|
2009-04-22 21:48:56 +03:00
|
|
|
private:
|
2009-04-16 14:14:13 +03:00
|
|
|
CSndHandler *sndh;
|
2009-04-22 21:48:56 +03:00
|
|
|
|
|
|
|
class cachedSounds {
|
|
|
|
public:
|
|
|
|
std::string filename;
|
|
|
|
Mix_Chunk *chunk;
|
|
|
|
|
|
|
|
// This is some horrible C++ abuse. Isn't there any way to do
|
|
|
|
// something simplier to init sounds?
|
|
|
|
cachedSounds(std::string filename_in, Mix_Chunk *chunk_in):
|
|
|
|
filename(filename_in), chunk(chunk_in) {};
|
|
|
|
};
|
|
|
|
|
|
|
|
std::map<soundBase::soundNames, cachedSounds> sounds;
|
|
|
|
|
|
|
|
Mix_Chunk *GetSoundChunk(std::string srcName);
|
|
|
|
|
2009-04-16 14:14:13 +03:00
|
|
|
public:
|
2009-04-22 21:48:56 +03:00
|
|
|
CMusicHandler(): sndh(NULL) {};
|
2009-04-16 14:14:13 +03:00
|
|
|
void initMusics();
|
|
|
|
|
2009-04-22 21:48:56 +03:00
|
|
|
// Sounds
|
|
|
|
int playSound(soundBase::soundNames soundID); // plays sound wavs from Heroes3.snd
|
|
|
|
};
|
2009-04-16 14:14:13 +03:00
|
|
|
|
|
|
|
#endif // __CMUSICHANDLER_H__
|