fix bug with new module sound by Gaetan

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@4820 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 8349fad9e34dac41ae7f15dc71913e0d1d9cca2b
Former-commit-id: 981664cc625fb8e2e086f6a0d789145eb877a0bc
This commit is contained in:
torcs-ng 2012-07-31 10:30:00 +00:00
parent 2ea4679db6
commit c0c0605a3d
7 changed files with 23 additions and 8 deletions

View file

@ -36,7 +36,7 @@ public:
//virtual void mute(bool bOn = true) = 0;
virtual void initSound(struct Situation* s) = 0;
virtual void shutdownSound(struct Situation* s) = 0;
virtual void shutdownSound() = 0;
virtual void refreshSound(struct Situation *s, SoundCam *camera) = 0;
virtual void mute(bool bOn = true) = 0;
};

View file

@ -156,7 +156,7 @@ void grInitSound(tSituation* s, int ncars)
void
grShutdownSound(int ncars)
grShutdownSound()
{
GfLogInfo("Shutting down sound engine\n");

View file

@ -26,7 +26,7 @@
class cGrCamera; //Declared in ""grcam.h"
extern void grInitSound(tSituation* s, int ncars);
extern void grShutdownSound(int ncars);
extern void grShutdownSound();
extern void grRefreshSound(tSituation *s, SoundCam *camera);
extern void grMuteSound(bool bOn = true);

View file

@ -72,8 +72,8 @@ sndDefault::~sndDefault()
void sndDefault::initSound(Situation* s){
grInitSound(s,s->_ncars);
}
void sndDefault::shutdownSound(Situation* s){
grShutdownSound(s->_ncars);
void sndDefault::shutdownSound(){
grShutdownSound();
}
void sndDefault::refreshSound(Situation *s, SoundCam *camera){
grRefreshSound(s, camera);

View file

@ -34,7 +34,7 @@ class ssgLoaderOptions;
// DLL exported symbols declarator for Windows.
#ifdef WIN32
# ifdef SNDDEFAULTDLL
# ifdef SNDDEFAULT_DLL
# define SNDDEFAULT_API __declspec(dllexport)
# else
# define SNDDEFAULT_API __declspec(dllimport)
@ -55,7 +55,7 @@ class SNDDEFAULT_API sndDefault : public GfModule, public ISoundEngine
public:
virtual void initSound(Situation* s);
virtual void shutdownSound(Situation* s);
virtual void shutdownSound();
virtual void refreshSound(Situation *s, SoundCam*camera);
virtual void mute(bool bOn = true);

View file

@ -18,6 +18,7 @@
#include <string>
#include <sstream>
#include <iostream>
#include <iraceengine.h>
#include <igraphicsengine.h>
@ -162,6 +163,7 @@ void LegacyMenu::quit() {
void LegacyMenu::shutdown() {
// Shutdown graphics in case relevant and not already done.
if (_piRaceEngine->inData()->_displayMode == RM_DISP_MODE_NORMAL) {
shutDownSound();
unloadCarsGraphics();
shutdownGraphicsView();
unloadTrackGraphics();
@ -330,8 +332,8 @@ void LegacyMenu::onRaceInterrupted() {
void LegacyMenu::onRaceFinishing() {
if (_piRaceEngine->inData()->_displayMode == RM_DISP_MODE_NORMAL) {
shutDownSound();
unloadCarsGraphics();
_piSoundEngine->shutdownSound(_piRaceEngine->outData()->s);
shutdownGraphicsView();
unloadTrackGraphics();
RmScreenShutdown();
@ -531,6 +533,18 @@ void LegacyMenu::redrawGraphicsView(struct Situation* pSituation) {
}
void LegacyMenu::shutDownSound() {
std::cout <<"there " << std::endl;
if (!_piSoundEngine)
return;
if (_bfGraphicsState & eCarsLoaded) {
std::cout <<"there " << std::endl;
_piSoundEngine->shutdownSound();
}
std::cout <<"there " << std::endl;
}
void LegacyMenu::unloadCarsGraphics() {
if (!_piGraphicsEngine)
return;

View file

@ -142,6 +142,7 @@ public:
void shutdownGraphicsView();
void unloadCarsGraphics();
void unloadTrackGraphics();
void shutDownSound();
//! Load stuff in the background of the splash screen (menus, XML data, ...).
static bool backLoad();