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 mute(bool bOn = true) = 0;
virtual void initSound(struct Situation* s) = 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 refreshSound(struct Situation *s, SoundCam *camera) = 0;
virtual void mute(bool bOn = true) = 0; virtual void mute(bool bOn = true) = 0;
}; };

View file

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

View file

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

View file

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

View file

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

View file

@ -18,6 +18,7 @@
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <iostream>
#include <iraceengine.h> #include <iraceengine.h>
#include <igraphicsengine.h> #include <igraphicsengine.h>
@ -162,6 +163,7 @@ void LegacyMenu::quit() {
void LegacyMenu::shutdown() { void LegacyMenu::shutdown() {
// Shutdown graphics in case relevant and not already done. // Shutdown graphics in case relevant and not already done.
if (_piRaceEngine->inData()->_displayMode == RM_DISP_MODE_NORMAL) { if (_piRaceEngine->inData()->_displayMode == RM_DISP_MODE_NORMAL) {
shutDownSound();
unloadCarsGraphics(); unloadCarsGraphics();
shutdownGraphicsView(); shutdownGraphicsView();
unloadTrackGraphics(); unloadTrackGraphics();
@ -330,8 +332,8 @@ void LegacyMenu::onRaceInterrupted() {
void LegacyMenu::onRaceFinishing() { void LegacyMenu::onRaceFinishing() {
if (_piRaceEngine->inData()->_displayMode == RM_DISP_MODE_NORMAL) { if (_piRaceEngine->inData()->_displayMode == RM_DISP_MODE_NORMAL) {
shutDownSound();
unloadCarsGraphics(); unloadCarsGraphics();
_piSoundEngine->shutdownSound(_piRaceEngine->outData()->s);
shutdownGraphicsView(); shutdownGraphicsView();
unloadTrackGraphics(); unloadTrackGraphics();
RmScreenShutdown(); 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() { void LegacyMenu::unloadCarsGraphics() {
if (!_piGraphicsEngine) if (!_piGraphicsEngine)
return; return;

View file

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