Skip to content

Commit

Permalink
PEGASUS: Switch sound playback to using the MMSound class
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Hoops committed Jun 15, 2011
1 parent ae1a932 commit 9aa9e6a
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 173 deletions.
22 changes: 10 additions & 12 deletions engines/pegasus/menu.cpp
Expand Up @@ -26,6 +26,8 @@
#include "pegasus/console.h"
#include "pegasus/pegasus.h"

#include "pegasus/MMShell/Sounds/MMSound.h"

namespace Pegasus {

enum {
Expand All @@ -44,7 +46,9 @@ enum {
};

void PegasusEngine::runMainMenu() {
_sound->playSound("Sounds/Main Menu.aiff", true);
MMSound sound;
sound.InitFromAIFFFile("Sounds/Main Menu.aiff");
sound.LoopSound();

// Note down how long since the last click
uint32 lastClickTime = _system->getMillis();
Expand Down Expand Up @@ -82,14 +86,14 @@ void PegasusEngine::runMainMenu() {
case Common::KEYCODE_RETURN:
if (buttonSelected != kDifficultyButton) {
drawMenuButtonSelected(buttonSelected);
sound.StopSound();
setGameMode(buttonSelected);

if (_gameMode != kMainMenuMode) {
_sound->stopSound();
if (_gameMode != kMainMenuMode)
return;
}


drawMenu(buttonSelected);
sound.LoopSound();
}
break;
case Common::KEYCODE_d:
Expand Down Expand Up @@ -118,7 +122,7 @@ void PegasusEngine::runMainMenu() {
return;

// Too slow! Go back and show the intro again.
_sound->stopSound();
sound.StopSound();
_video->playMovie(_introDirectory + "/LilMovie.movie");
_gameMode = kIntroMode;
}
Expand Down Expand Up @@ -173,9 +177,7 @@ void PegasusEngine::setGameMode(int buttonSelected) {
_gameMode = kMainGameMode;
break;
case kDemoCreditsButton:
_sound->stopSound();
runDemoCredits();
_sound->playSound("Sounds/Main Menu.aiff", true);
break;
case kDemoQuitButton:
_gameMode = kQuitMode;
Expand All @@ -184,9 +186,7 @@ void PegasusEngine::setGameMode(int buttonSelected) {
} else {
switch (buttonSelected) {
case kInterfaceOverviewButton:
_sound->stopSound();
runInterfaceOverview();
_sound->playSound("Sounds/Main Menu.aiff", true);
break;
case kStartButton:
_gameMode = kMainGameMode;
Expand All @@ -195,9 +195,7 @@ void PegasusEngine::setGameMode(int buttonSelected) {
showLoadDialog();
break;
case kCreditsButton:
_sound->stopSound();
runCredits();
_sound->playSound("Sounds/Main Menu.aiff", true);
break;
case kQuitButton:
_gameMode = kQuitMode;
Expand Down
1 change: 0 additions & 1 deletion engines/pegasus/module.mk
Expand Up @@ -8,7 +8,6 @@ MODULE_OBJS = \
menu.o \
overview.o \
pegasus.o \
sound.o \
video.o \
Game_Shell/CItem.o \
MMShell/Sounds/MMSound.o \
Expand Down
10 changes: 7 additions & 3 deletions engines/pegasus/pegasus.cpp
Expand Up @@ -37,14 +37,17 @@
//#define RUN_SUB_MOVIE // :D :D :D :D :D :D
//#define RUN_INTERFACE_TEST

#ifdef RUN_INTERFACE_TEST
#include "pegasus/MMShell/Sounds/MMSound.h"
#endif

namespace Pegasus {

PegasusEngine::PegasusEngine(OSystem *syst, const PegasusGameDescription *gamedesc) : Engine(syst), _gameDescription(gamedesc) {
}

PegasusEngine::~PegasusEngine() {
delete _video;
delete _sound;
delete _gfx;
delete _resFork;
delete _inventoryLid;
Expand All @@ -56,7 +59,6 @@ Common::Error PegasusEngine::run() {
_console = new PegasusConsole(this);
_gfx = new GraphicsManager(this);
_video = new VideoManager(this);
_sound = new SoundManager(this);
_resFork = new Common::MacResManager();
_inventoryLid = new Common::MacResManager();
_biochipLid = new Common::MacResManager();
Expand Down Expand Up @@ -112,7 +114,9 @@ Common::Error PegasusEngine::run() {
#elif defined(RUN_INTERFACE_TEST)
drawInterface();
_gfx->setCursor(kMainCursor);
_sound->playSound("Sounds/Caldoria/Apartment Music.aiff", true);
MMSound sound;
sound.InitFromAIFFFile("Sounds/Caldoria/Apartment Music.aiff");
sound.LoopSound();

while (!shouldQuit()) {
Common::Event event;
Expand Down
2 changes: 0 additions & 2 deletions engines/pegasus/pegasus.h
Expand Up @@ -31,7 +31,6 @@

#include "engines/engine.h"

#include "pegasus/sound.h"
#include "pegasus/graphics.h"
#include "pegasus/video.h"

Expand Down Expand Up @@ -204,7 +203,6 @@ class PegasusEngine : public ::Engine {
GUI::Debugger *getDebugger();

VideoManager *_video;
SoundManager *_sound;
GraphicsManager *_gfx;
Common::MacResManager *_resFork, *_inventoryLid, *_biochipLid;

Expand Down
86 changes: 0 additions & 86 deletions engines/pegasus/sound.cpp

This file was deleted.

69 changes: 0 additions & 69 deletions engines/pegasus/sound.h

This file was deleted.

0 comments on commit 9aa9e6a

Please sign in to comment.