Skip to content

Commit

Permalink
DM: Add SoundMan_Atari
Browse files Browse the repository at this point in the history
  • Loading branch information
Bendegúz Nagy committed Aug 26, 2016
1 parent 0eb61d0 commit 621d83c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
4 changes: 2 additions & 2 deletions engines/dm/dm.cpp
Expand Up @@ -224,7 +224,7 @@ DMEngine::~DMEngine() {
delete _dialog;
delete _sound;



delete[] _savedScreenForOpenEntranceDoors;
// clear debug channels
Expand Down Expand Up @@ -361,7 +361,7 @@ Common::Error DMEngine::run() {
_timeline = new Timeline(this);
_projexpl = new ProjExpl(this);
_dialog = new DialogMan(this);
_sound = new SoundMan(this);
_sound = SoundMan::getSoundMan(this, _gameVersion);
_displayMan->setUpScreens(320, 200);

f463_initializeGame();
Expand Down
11 changes: 11 additions & 0 deletions engines/dm/sounds.cpp
Expand Up @@ -27,6 +27,7 @@

#include "audio/audiostream.h"
#include "audio/decoders/raw.h"
#include <advancedDetector.h>

#include "dm.h"
#include "gfx.h"
Expand All @@ -38,13 +39,22 @@

namespace DM {

SoundMan* SoundMan::getSoundMan(DMEngine* vm, const ADGameDescription* gameVersion) {
switch (gameVersion->platform) {
default: warning(false, "Unknown platform, using default Amiga SoundMan");
case Common::kPlatformAmiga: return new SoundMan(vm);
case Common::kPlatformAtariST: return new SoundMan_Atari(vm);
}
}

SoundMan::SoundMan(DMEngine* vm) : _vm(vm) {}

SoundMan::~SoundMan() {
for (uint16 i = 0; i < k34_D13_soundCount; ++i)
delete[] _gK24_soundData[i]._firstSample;
}


Sound g60_sounds[k34_D13_soundCount] = {
Sound(533, 112, 11, 3, 6), /* k00_soundMETALLIC_THUD 0 */
Sound(534, 112, 15, 0, 3), /* k01_soundSWITCH 1 */
Expand Down Expand Up @@ -207,4 +217,5 @@ void SoundMan::f064_SOUND_RequestPlay_CPSD(uint16 soundIndex, int16 mapX, int16
_pendingSounds.push(PendingSound(leftVolume, rightVolume, soundIndex));
}


}
23 changes: 18 additions & 5 deletions engines/dm/sounds.h
Expand Up @@ -63,18 +63,31 @@ class PendingSound {
class SoundMan {
DMEngine *_vm;

public:
protected:
SoundMan(DMEngine* vm);
~SoundMan();
public:
virtual ~SoundMan();

static SoundMan *getSoundMan(DMEngine *vm, const ADGameDescription *gameVersion);

SoundData _gK24_soundData[k34_D13_soundCount]; // @ K0024_as_SoundData
Common::Queue<PendingSound> _pendingSounds;

void f503_loadSounds(); // @ F0503_SOUND_LoadAll
void f064_SOUND_RequestPlay_CPSD(uint16 P0088_ui_SoundIndex, int16 P0089_i_MapX, int16 P0090_i_MapY, uint16 P0091_ui_Mode); // @ F0064_SOUND_RequestPlay_CPSD
void f060_SOUND_Play(uint16 P0921_ui_SoundIndex, uint16 P0085_i_Period, uint8 leftVol, uint8 rightVol); // @ F0060_SOUND_Play
virtual void f503_loadSounds(); // @ F0503_SOUND_LoadAll
virtual void f064_SOUND_RequestPlay_CPSD(uint16 P0088_ui_SoundIndex, int16 P0089_i_MapX, int16 P0090_i_MapY, uint16 P0091_ui_Mode); // @ F0064_SOUND_RequestPlay_CPSD
virtual void f060_SOUND_Play(uint16 P0921_ui_SoundIndex, uint16 P0085_i_Period, uint8 leftVol, uint8 rightVol); // @ F0060_SOUND_Play
void f65_playPendingSound(); // @ F0065_SOUND_PlayPendingSound_CPSD
bool f505_soundGetVolume(int16 mapX, int16 mapY, uint8 *leftVolume, uint8 *rightVolume); // @ F0505_SOUND_GetVolume
};

class SoundMan_Atari: public SoundMan {
friend class SoundMan;

SoundMan_Atari(DMEngine* vm): SoundMan(vm) {};
public:
void f503_loadSounds() override {} // @ F0503_SOUND_LoadAll
void f064_SOUND_RequestPlay_CPSD(uint16 P0088_ui_SoundIndex, int16 P0089_i_MapX, int16 P0090_i_MapY, uint16 P0091_ui_Mode) override {} // @ F0064_SOUND_RequestPlay_CPSD
void f060_SOUND_Play(uint16 P0921_ui_SoundIndex, uint16 P0085_i_Period, uint8 leftVol, uint8 rightVol) override {} // @ F0060_SOUND_Play
};

}

0 comments on commit 621d83c

Please sign in to comment.