aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorEugene Sandulenko2007-11-19 20:34:26 +0000
committerEugene Sandulenko2007-11-19 20:34:26 +0000
commit8a145bbb53eb82e18a31b39dcb5eba522940fd6d (patch)
tree9f5da5f1db864f889411c9692daeb3fa68020c15 /engines/agi
parentd86246308d31b898ca22462de3a68910b52e0eb1 (diff)
downloadscummvm-rg350-8a145bbb53eb82e18a31b39dcb5eba522940fd6d.tar.gz
scummvm-rg350-8a145bbb53eb82e18a31b39dcb5eba522940fd6d.tar.bz2
scummvm-rg350-8a145bbb53eb82e18a31b39dcb5eba522940fd6d.zip
Hook PC Speaker to Troll's Tale. Though pitch and duration are wrong
svn-id: r29569
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/preagi.cpp11
-rw-r--r--engines/agi/preagi.h7
-rw-r--r--engines/agi/preagi_common.cpp5
-rw-r--r--engines/agi/preagi_troll.cpp2
4 files changed, 21 insertions, 4 deletions
diff --git a/engines/agi/preagi.cpp b/engines/agi/preagi.cpp
index 217134c525..413f9250d0 100644
--- a/engines/agi/preagi.cpp
+++ b/engines/agi/preagi.cpp
@@ -149,7 +149,7 @@ void PreAgiEngine::initialize() {
}
_gfx = new GfxMgr(this);
- _sound = new SoundMgr(this, _mixer);
+ //_sound = new SoundMgr(this, _mixer);
_picture = new PictureMgr(this, _gfx);
//_sprites = new SpritesMgr(this, _gfx);
@@ -171,7 +171,12 @@ void PreAgiEngine::initialize() {
_game.lineMinPrint = 0; // hardcoded
_gfx->initVideo();
- _sound->initSound();
+ //_sound->initSound();
+
+ _speakerStream = new Audio::PCSpeaker(_mixer->getOutputRate());
+ _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_speakerHandle,
+ _speakerStream, -1, 255, 0, false, true);
+
//_timer->installTimerProc(agiTimerFunctionLow, 10 * 1000, NULL);
@@ -191,7 +196,7 @@ void PreAgiEngine::initialize() {
}
PreAgiEngine::~PreAgiEngine() {
-
+ delete _speakerStream;
}
int PreAgiEngine::init() {
diff --git a/engines/agi/preagi.h b/engines/agi/preagi.h
index 39e61592ae..0644a185c0 100644
--- a/engines/agi/preagi.h
+++ b/engines/agi/preagi.h
@@ -29,6 +29,8 @@
#include "agi/agi.h"
#include "agi/preagi_common.h"
+#include "sound/softsynth/pcspk.h"
+
namespace Agi {
class PreAgiEngine : public AgiBase {
@@ -88,8 +90,13 @@ public:
// Saved Games
Common::SaveFileManager* getSaveFileMan() { return _saveFileMan; }
+ void playNote(int16 frequency, int32 length);
+
private:
int _defaultColor;
+
+ Audio::PCSpeaker *_speakerStream;
+ Audio::SoundHandle _speakerHandle;
};
} // End of namespace Agi
diff --git a/engines/agi/preagi_common.cpp b/engines/agi/preagi_common.cpp
index 65e59892d6..a2eec53e95 100644
--- a/engines/agi/preagi_common.cpp
+++ b/engines/agi/preagi_common.cpp
@@ -190,4 +190,9 @@ int PreAgiEngine::getSelection(SelectionTypes type) {
return 0;
}
+void PreAgiEngine::playNote(int16 frequency, int32 length) {
+ _speakerStream->play(Audio::PCSpeaker::kWaveFormSquare, frequency, length);
+ _vm->_system->delayMillis(duration);
+}
+
}
diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp
index f8fc581112..7f7b007e78 100644
--- a/engines/agi/preagi_troll.cpp
+++ b/engines/agi/preagi_troll.cpp
@@ -483,7 +483,7 @@ void Troll::playTune(int tune, int len) {
duration = READ_LE_UINT16(_gameData + ptr);
ptr += 2;
- // playNote(freq, duration);
+ _vm->playNote(freq, duration);
}
}