mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Split audioh into soundh and musich. Derive both from a new CAudioBase class. Fixed crash when there is no sound card present.
This commit is contained in:
@@ -150,9 +150,9 @@ void CPlayerInterface::yourTurn()
|
||||
* NEWDAY. And we don't play NEWMONTH. */
|
||||
int day = cb->getDate(1);
|
||||
if (day != 1)
|
||||
CGI->audioh->playSound(soundBase::newDay);
|
||||
CGI->soundh->playSound(soundBase::newDay);
|
||||
else
|
||||
CGI->audioh->playSound(soundBase::newWeek);
|
||||
CGI->soundh->playSound(soundBase::newWeek);
|
||||
|
||||
adventureInt->infoBar.newDay(day);
|
||||
|
||||
@@ -820,7 +820,7 @@ void CPlayerInterface::heroCreated(const CGHeroInstance * hero)
|
||||
void CPlayerInterface::openTownWindow(const CGTownInstance * town)
|
||||
{
|
||||
castleInt = new CCastleInterface(town);
|
||||
CGI->audioh->playMusic(castleInt->musicID, -1);
|
||||
CGI->musich->playMusic(castleInt->musicID, -1);
|
||||
LOCPLINT->pushInt(castleInt);
|
||||
}
|
||||
|
||||
@@ -1064,7 +1064,7 @@ void CPlayerInterface::heroGotLevel(const CGHeroInstance *hero, int pskill, std:
|
||||
showingDialog->cond.wait(un);
|
||||
}
|
||||
|
||||
CGI->audioh->playSound(soundBase::heroNewLevel);
|
||||
CGI->soundh->playSound(soundBase::heroNewLevel);
|
||||
|
||||
boost::unique_lock<boost::recursive_mutex> un(*pim);
|
||||
CLevelWindow *lw = new CLevelWindow(hero,pskill,skills,callback);
|
||||
@@ -1165,7 +1165,7 @@ void CPlayerInterface::buildChanged(const CGTownInstance *town, int buildingID,
|
||||
switch(what)
|
||||
{
|
||||
case 1:
|
||||
CGI->audioh->playSound(soundBase::newBuilding);
|
||||
CGI->soundh->playSound(soundBase::newBuilding);
|
||||
castleInt->addBuilding(buildingID);
|
||||
break;
|
||||
case 2:
|
||||
@@ -1181,7 +1181,7 @@ void CPlayerInterface::battleStart(CCreatureSet *army1, CCreatureSet *army2, int
|
||||
|
||||
boost::unique_lock<boost::recursive_mutex> un(*pim);
|
||||
battleInt = new CBattleInterface(army1, army2, hero1, hero2, genRect(600, 800, (conf.cc.resx - 800)/2, (conf.cc.resy - 600)/2));
|
||||
CGI->audioh->playMusicFromSet(CGI->audioh->battleMusics, -1);
|
||||
CGI->musich->playMusicFromSet(CGI->musich->battleMusics, -1);
|
||||
pushInt(battleInt);
|
||||
}
|
||||
|
||||
@@ -1389,7 +1389,7 @@ void CPlayerInterface::showComp(SComponent comp)
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> un(*pim);
|
||||
|
||||
CGI->audioh->playSoundFromSet(CGI->audioh->pickupSounds);
|
||||
CGI->soundh->playSoundFromSet(CGI->soundh->pickupSounds);
|
||||
|
||||
adventureInt->infoBar.showComp(&comp,4000);
|
||||
}
|
||||
@@ -1421,7 +1421,7 @@ void CPlayerInterface::showInfoDialog(const std::string &text, const std::vector
|
||||
|
||||
if(makingTurn && listInt.size())
|
||||
{
|
||||
CGI->audioh->playSound(static_cast<soundBase::soundID>(soundID));
|
||||
CGI->soundh->playSound(static_cast<soundBase::soundID>(soundID));
|
||||
showingDialog->set(true);
|
||||
pushInt(temp);
|
||||
}
|
||||
@@ -1452,7 +1452,7 @@ void CPlayerInterface::showBlockingDialog( const std::string &text, const std::v
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> un(*pim);
|
||||
|
||||
CGI->audioh->playSound(static_cast<soundBase::soundID>(soundID));
|
||||
CGI->soundh->playSound(static_cast<soundBase::soundID>(soundID));
|
||||
|
||||
if(!selection && cancel) //simple yes/no dialog
|
||||
{
|
||||
@@ -1588,18 +1588,18 @@ bool CPlayerInterface::moveHero( const CGHeroInstance *h, CPath path )
|
||||
#if 0
|
||||
// TODO
|
||||
if (hero is flying && sh == -1)
|
||||
sh = CGI->audioh->playSound(soundBase::horseFlying, -1);
|
||||
sh = CGI->soundh->playSound(soundBase::horseFlying, -1);
|
||||
}
|
||||
else if (hero is in a boat && sh = -1) {
|
||||
sh = CGI->audioh->playSound(soundBase::sound_todo, -1);
|
||||
sh = CGI->soundh->playSound(soundBase::sound_todo, -1);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
newTerrain = cb->getTileInfo(path.nodes[i].coord)->tertype;
|
||||
|
||||
if (newTerrain != currentTerrain) {
|
||||
CGI->audioh->stopSound(sh);
|
||||
sh = CGI->audioh->playSound(CGI->audioh->horseSounds[newTerrain], -1);
|
||||
CGI->soundh->stopSound(sh);
|
||||
sh = CGI->soundh->playSound(CGI->soundh->horseSounds[newTerrain], -1);
|
||||
currentTerrain = newTerrain;
|
||||
}
|
||||
}
|
||||
@@ -1612,7 +1612,7 @@ bool CPlayerInterface::moveHero( const CGHeroInstance *h, CPath path )
|
||||
stillMoveHero.cond.wait(un);
|
||||
}
|
||||
|
||||
CGI->audioh->stopSound(sh);
|
||||
CGI->soundh->stopSound(sh);
|
||||
|
||||
//stillMoveHero = false;
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user