diff options
| author | Bendegúz Nagy | 2016-08-01 17:03:50 +0200 | 
|---|---|---|
| committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 | 
| commit | a387f45d57241dbc8f96e214bb0b90a6069a75bb (patch) | |
| tree | 809fcbc133bd309ec614cb19e0e950e3d9b05cbb | |
| parent | 03db641f251891760a8c54426110d902d45186a3 (diff) | |
| download | scummvm-rg350-a387f45d57241dbc8f96e214bb0b90a6069a75bb.tar.gz scummvm-rg350-a387f45d57241dbc8f96e214bb0b90a6069a75bb.tar.bz2 scummvm-rg350-a387f45d57241dbc8f96e214bb0b90a6069a75bb.zip  | |
DM: Add f60_playSound
| -rw-r--r-- | engines/dm/dm.h | 4 | ||||
| -rw-r--r-- | engines/dm/sounds.cpp | 12 | 
2 files changed, 15 insertions, 1 deletions
diff --git a/engines/dm/dm.h b/engines/dm/dm.h index 33c3b0336c..02def018d1 100644 --- a/engines/dm/dm.h +++ b/engines/dm/dm.h @@ -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: diff --git a/engines/dm/sounds.cpp b/engines/dm/sounds.cpp index 681ff6da22..cdbed462a3 100644 --- a/engines/dm/sounds.cpp +++ b/engines/dm/sounds.cpp @@ -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); +} +  }  | 
