diff options
author | Peter Kohaut | 2018-01-14 12:12:06 +0100 |
---|---|---|
committer | Peter Kohaut | 2018-01-28 10:57:16 +0100 |
commit | 1e5f9d3078f236f306b5d868bcd52f4e47f7b512 (patch) | |
tree | 0d402af27d75064d60e4674ab3bd4c9ad08759f1 /engines/bladerunner/music.cpp | |
parent | 3a937f19c0a5e347c801c62d345475be082f9e41 (diff) | |
download | scummvm-rg350-1e5f9d3078f236f306b5d868bcd52f4e47f7b512.tar.gz scummvm-rg350-1e5f9d3078f236f306b5d868bcd52f4e47f7b512.tar.bz2 scummvm-rg350-1e5f9d3078f236f306b5d868bcd52f4e47f7b512.zip |
BLADERUNNER: Added basic KIA interface
Settings works
Help works
Clue database works
Fixed code for inserting objects into scene
Reorganization of few files
Unification & code formatting of few older files
Diffstat (limited to 'engines/bladerunner/music.cpp')
-rw-r--r-- | engines/bladerunner/music.cpp | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/engines/bladerunner/music.cpp b/engines/bladerunner/music.cpp index 6b7a733338..88fb3e0b55 100644 --- a/engines/bladerunner/music.cpp +++ b/engines/bladerunner/music.cpp @@ -25,15 +25,16 @@ #include "bladerunner/audio_mixer.h" #include "bladerunner/aud_stream.h" #include "bladerunner/bladerunner.h" +#include "bladerunner/game_info.h" #include "common/timer.h" namespace BladeRunner { -Music::Music(BladeRunnerEngine *vm) - : _vm(vm) { +Music::Music(BladeRunnerEngine *vm) { + _vm = vm; _channel = -1; - _volume = 65; + _musicVolume = 65; _isPlaying = false; _isPaused = false; _current.loop = false; @@ -52,14 +53,14 @@ Music::~Music() { _vm->getTimerManager()->removeTimerProc(timerCallbackNext); } -bool Music::play(const char *trackName, int volume, int pan, int timeFadeIn, int timePlay, int loop, int timeFadeOut) { +bool Music::play(const Common::String &trackName, int volume, int pan, int timeFadeIn, int timePlay, int loop, int timeFadeOut) { //Common::StackLock lock(_mutex); - if (_volume <= 0) { + if (_musicVolume <= 0) { return false; } - int volumeAdjusted = volume * _volume / 100; + int volumeAdjusted = volume * _musicVolume / 100; int volumeStart = volumeAdjusted; if (timeFadeIn > 0) { volumeStart = 1; @@ -134,7 +135,7 @@ void Music::stop(int delay) { void Music::adjust(int volume, int pan, int delay) { if (volume != -1) { - adjustVolume(_volume * volume/ 100, delay); + adjustVolume(_musicVolume * volume/ 100, delay); } if (pan != -101) { adjustPan(pan, delay); @@ -146,11 +147,21 @@ bool Music::isPlaying() { } void Music::setVolume(int volume) { - _volume = volume; + _musicVolume = volume; if (volume <= 0) { stop(2); } else if (isPlaying()) { - _vm->_audioMixer->adjustVolume(_channel, _volume * _current.volume / 100, 120); + _vm->_audioMixer->adjustVolume(_channel, _musicVolume * _current.volume / 100, 120); + } +} + +int Music::getVolume() { + return _musicVolume; +} + +void Music::playSample() { + if (!isPlaying()) { + play(_vm->_gameInfo->getSfxTrack(512), 100, 0, 2, -1, 0, 3); } } @@ -214,7 +225,7 @@ void Music::timerCallbackNext(void *refCon) { ((Music *)refCon)->next(); } -byte *Music::getData(const char *name) { +byte *Music::getData(const Common::String &name) { // NOTE: This is not part original game, loading data is done in the mixer and its using buffering to limit memory usage Common::SeekableReadStream *stream = _vm->getResourceStream(name); if (stream == nullptr) { |