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/audio_speech.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/audio_speech.cpp')
-rw-r--r-- | engines/bladerunner/audio_speech.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/engines/bladerunner/audio_speech.cpp b/engines/bladerunner/audio_speech.cpp index 90fc213f2d..1f3465c7eb 100644 --- a/engines/bladerunner/audio_speech.cpp +++ b/engines/bladerunner/audio_speech.cpp @@ -22,6 +22,7 @@ #include "bladerunner/audio_speech.h" +#include "bladerunner/actor.h" #include "bladerunner/aud_stream.h" #include "bladerunner/audio_mixer.h" #include "bladerunner/bladerunner.h" @@ -30,7 +31,7 @@ namespace BladeRunner { -#define BUFFER_SIZE 200000 +const int AudioSpeech::kSpeechSamples[] = { 65, 355, 490, 465, 480, 485, 505, 760, 7655, 7770, 7740, 8170, 2705, 7200, 6460, 5560, 4870, 4555, 3880, 3525, 3595, 3250, 3070 }; void AudioSpeech::ended() { //Common::StackLock lock(_mutex); @@ -39,14 +40,15 @@ void AudioSpeech::ended() { } void AudioSpeech::mixerChannelEnded(int channel, void *data) { - AudioSpeech *audioSpeech = (AudioSpeech*)data; + AudioSpeech *audioSpeech = (AudioSpeech *)data; audioSpeech->ended(); } -AudioSpeech::AudioSpeech(BladeRunnerEngine *vm) : _vm(vm) { - _volume = 50; +AudioSpeech::AudioSpeech(BladeRunnerEngine *vm) { + _vm = vm; + _speechVolume = 50; _isActive = false; - _data = new byte[BUFFER_SIZE]; + _data = new byte[kBufferSize]; _channel = -1; } @@ -63,8 +65,8 @@ bool AudioSpeech::playSpeech(const char *name, int pan) { return false; } - if (r->size() > BUFFER_SIZE) { - warning("AudioSpeech::playSpeech: AUD larger than buffer size (%d > %d)", r->size(), BUFFER_SIZE); + if (r->size() > kBufferSize) { + warning("AudioSpeech::playSpeech: AUD larger than buffer size (%d > %d)", r->size(), kBufferSize); return false; } @@ -87,7 +89,7 @@ bool AudioSpeech::playSpeech(const char *name, int pan) { audioStream, 100, false, - _volume, + _speechVolume, pan, mixerChannelEnded, this); @@ -104,11 +106,23 @@ void AudioSpeech::stopSpeech() { } } -bool AudioSpeech::isPlaying() { +bool AudioSpeech::isPlaying() const { if (_channel == -1) { return false; } return _isActive; } +void AudioSpeech::setVolume(int volume) { + _speechVolume = volume; +} + +int AudioSpeech::getVolume() const { + return _speechVolume; +} + +void AudioSpeech::playSample() { + _vm->_playerActor->speechPlay(kSpeechSamples[_vm->_rnd.getRandomNumber(22)], true); +} + } // End of namespace BladeRunner |