DM: Add f60_playSound

This commit is contained in:
Bendegúz Nagy 2016-08-01 17:03:50 +02:00
parent 03db641f25
commit a387f45d57
2 changed files with 15 additions and 1 deletions

View file

@ -205,6 +205,8 @@ public:
SoundData(): _byteCount(0), _firstSample(nullptr), _sampleCount(0) {}
}; // @ SOUND_DATA
class DMEngine : public Engine {
void f462_startGame(); // @ F0462_START_StartGame_CPSF
void f3_processNewPartyMap(uint16 mapIndex); // @ F0003_MAIN_ProcessNewPartyMap_CPSE
@ -235,7 +237,7 @@ public:
void f444_endGame(bool doNotDrawCreditsOnly); // @ F0444_STARTEND_Endgame
void f064_SOUND_RequestPlay_CPSD(uint16 P0088_ui_SoundIndex, int16 P0089_i_MapX, int16 P0090_i_MapY, uint16 P0091_ui_Mode) { warning(true, "STUB: f064_SOUND_RequestPlay_CPSD"); }
void f060_SOUND_Play(uint16 P0921_ui_SoundIndex, uint16 P0085_i_Period, uint8 leftVol, uint8 rightVol) { warning(true, "STUB: f060_SOUND_Play"); }
void f060_SOUND_Play(uint16 P0921_ui_SoundIndex, uint16 P0085_i_Period, uint8 leftVol, uint8 rightVol);
void f438_STARTEND_OpenEntranceDoors() { warning(true, "STUB: f438_STARTEND_OpenEntranceDoors"); }
private:

View file

@ -30,6 +30,7 @@
#include "dm.h"
#include "gfx.h"
#include <audio/mixer.h>
namespace DM {
@ -96,4 +97,15 @@ void DMEngine::f503_loadSounds() {
}
}
void DMEngine::f060_SOUND_Play(uint16 soundIndex, uint16 period, uint8 leftVolume, uint8 rightVolume) {
byte soundFlags = Audio::FLAG_STEREO;
SoundData *sound = &_gK24_soundData[soundIndex];
Audio::AudioStream *stream = Audio::makeRawStream(sound->_firstSample, sound->_byteCount, 72800 / period, soundFlags, DisposeAfterUse::NO);
signed char balance = ((int16)rightVolume - (int16)leftVolume) / 2;
Audio::SoundHandle handle;
_mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, stream, - 1, 127, balance);
}
}