aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorPaweł Kołodziejski2002-10-15 21:55:04 +0000
committerPaweł Kołodziejski2002-10-15 21:55:04 +0000
commit09225027f1f8b87360952904b6f55f69976b040a (patch)
tree4cca795d9594cdfbb3b6d4ba53ed090e6e41fae3 /scumm
parent15ac1c1ee9292073fb8dead67111e31c8f328690 (diff)
downloadscummvm-rg350-09225027f1f8b87360952904b6f55f69976b040a.tar.gz
scummvm-rg350-09225027f1f8b87360952904b6f55f69976b040a.tar.bz2
scummvm-rg350-09225027f1f8b87360952904b6f55f69976b040a.zip
changes to imuse
svn-id: r5157
Diffstat (limited to 'scumm')
-rw-r--r--scumm/imuse.cpp26
-rw-r--r--scumm/imuse.h2
-rw-r--r--scumm/smush/scumm_renderer.cpp18
-rw-r--r--scumm/sound.cpp6
4 files changed, 28 insertions, 24 deletions
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp
index 82f1232e9f..1da040876b 100644
--- a/scumm/imuse.cpp
+++ b/scumm/imuse.cpp
@@ -4997,11 +4997,18 @@ static void imus_digital_handler(void * engine) {
IMuseDigital::IMuseDigital(Scumm *scumm) {
memset(_channel, 0, sizeof(channel) * MAX_DIGITAL_CHANNELS);
_scumm = scumm;
+ for (int32 l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
+ _channel[l]._mixerTrack = -1;
+ }
+ _scumm->_mixer->beginSlots(MAX_DIGITAL_CHANNELS + 1);
_scumm->_timer->installProcedure(imus_digital_handler, 200);
_pause = false;
}
IMuseDigital::~IMuseDigital() {
+ for (int32 l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
+ _scumm->_mixer->stop(l);
+ }
_scumm->_timer->releaseProcedure(imus_digital_handler);
}
@@ -5406,7 +5413,6 @@ void IMuseDigital::handler() {
if (_channel[l]._toBeRemoved == true) {
_channel[l]._used = false;
free(_channel[l]._data);
- memset(&_channel[l], 0, sizeof(channel));
continue;
}
@@ -5507,16 +5513,11 @@ void IMuseDigital::handler() {
}
}
-
if (_channel[l]._mixerTrack == -1) {
- _channel[l]._mixerTrack = _scumm->_mixer->playStream(NULL, -1, buf, mixer_size,
- _channel[l]._freq, _channel[l]._mixerFlags);
- continue;
- } else if (_scumm->_mixer->_channels[_channel[l]._mixerTrack] == NULL) {
- _channel[l]._mixerTrack = _scumm->_mixer->playStream(NULL, -1, buf, mixer_size,
- _channel[l]._freq, _channel[l]._mixerFlags);
+ _channel[l]._mixerTrack = _scumm->_mixer->playStream(NULL, l, buf, mixer_size,
+ _channel[l]._freq, _channel[l]._mixerFlags, -1, 800000);
} else {
- _scumm->_mixer->append(_channel[l]._mixerTrack, buf, mixer_size,
+ _scumm->_mixer->append(l, buf, mixer_size,
_channel[l]._freq, _channel[l]._mixerFlags);
}
}
@@ -5550,7 +5551,6 @@ void IMuseDigital::startSound(int sound) {
if (READ_UINT32_UNALIGNED(ptr) == MKID('Crea')) {
_channel[l]._bits = 8;
_channel[l]._channels = 2;
- _channel[l]._mixerTrack = -1;
_channel[l]._mixerSize = (22050 / 5) * 2;
_channel[l]._mixerFlags = SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO | SoundMixer::FLAG_UNSIGNED;
byte * t_ptr= _scumm->_sound->readCreativeVocFile(ptr, size, _channel[l]._freq, _channel[l]._numLoops);
@@ -5624,6 +5624,11 @@ void IMuseDigital::startSound(int sound) {
if (tag == MKID_BE('DATA')) break;
}
+ if ((sound == 123) || (sound == 122)) {
+ _channel[l]._isJump = false;
+ _channel[l]._numJumps = 0;
+ }
+
uint32 header_size = ptr - s_ptr;
_channel[l]._offsetStop -= header_size;
if (_channel[l]._bits == 12) {
@@ -5646,7 +5651,6 @@ void IMuseDigital::startSound(int sound) {
}
}
}
- _channel[l]._mixerTrack = -1;
_channel[l]._mixerSize = (22050 / 5) * 2;
_channel[l]._mixerFlags = SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO;
if (_channel[l]._bits == 12) {
diff --git a/scumm/imuse.h b/scumm/imuse.h
index 2620276073..0740d5d075 100644
--- a/scumm/imuse.h
+++ b/scumm/imuse.h
@@ -61,7 +61,7 @@ private:
IMuseInternal *_imuse; // Pointer to the real imuse object
};
-#define MAX_DIGITAL_CHANNELS 16
+#define MAX_DIGITAL_CHANNELS 8
#define MAX_IMUSE_JUMPS 1
#define MAX_IMUSE_REGIONS 3
diff --git a/scumm/smush/scumm_renderer.cpp b/scumm/smush/scumm_renderer.cpp
index 94e0616ebd..89cc8dadb5 100644
--- a/scumm/smush/scumm_renderer.cpp
+++ b/scumm/smush/scumm_renderer.cpp
@@ -51,8 +51,8 @@ public:
bool update();
};
-ScummMixer::ScummMixer(SoundMixer * m) : _mixer(m), _nextIndex(0) {
- for(int32 i = 0; i < SoundMixer::NUM_CHANNELS; i++) {
+ScummMixer::ScummMixer(SoundMixer * m) : _mixer(m), _nextIndex(_mixer->_beginSlots) {
+ for(int32 i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) {
_channels[i].id = -1;
_channels[i].chan = 0;
_channels[i].first = true;
@@ -69,7 +69,7 @@ bool ScummMixer::init() {
_Channel * ScummMixer::findChannel(int32 track) {
debug(9, "scumm_mixer::findChannel(%d)", track);
- for(int32 i = 0; i < SoundMixer::NUM_CHANNELS; i++) {
+ for(int32 i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) {
if(_channels[i].id == track)
return _channels[i].chan;
}
@@ -82,11 +82,11 @@ bool ScummMixer::addChannel(_Channel * c) {
debug(9, "ScummMixer::addChannel(%d)", track);
- for(i = 0; i < SoundMixer::NUM_CHANNELS; i++) {
+ for(i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) {
if(_channels[i].id == track)
warning("mixer::addChannel(%d) : channel already exist !", track);
}
- if(_nextIndex >= SoundMixer::NUM_CHANNELS) _nextIndex = 0;
+ if(_nextIndex >= SoundMixer::NUM_CHANNELS) _nextIndex = _mixer->_beginSlots;
for(i = _nextIndex; i < SoundMixer::NUM_CHANNELS; i++) {
if(_channels[i].chan == 0 || _channels[i].id == -1) {
@@ -98,7 +98,7 @@ bool ScummMixer::addChannel(_Channel * c) {
}
}
- for(i = 0; i < _nextIndex; i++) {
+ for(i = _mixer->_beginSlots; i < _nextIndex; i++) {
if(_channels[i].chan == 0 || _channels[i].id == -1) {
_channels[i].chan = c;
_channels[i].id = track;
@@ -110,7 +110,7 @@ bool ScummMixer::addChannel(_Channel * c) {
fprintf(stderr, "_nextIndex == %d\n", _nextIndex);
- for(i = 0; i < SoundMixer::NUM_CHANNELS; i++) {
+ for(i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) {
fprintf(stderr, "channel %d : %p(%ld, %d) %d %d\n", i, _channels[i].chan,
_channels[i].chan ? _channels[i].chan->getTrackIdentifier() : -1,
_channels[i].chan ? _channels[i].chan->isTerminated() : 1,
@@ -123,7 +123,7 @@ bool ScummMixer::addChannel(_Channel * c) {
bool ScummMixer::handleFrame() {
debug(9, "ScummMixer::handleFrame()");
- for(int i = 0; i < SoundMixer::NUM_CHANNELS; i++) {
+ for(int i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) {
if(_channels[i].id != -1) {
debug(9, "updating channel %d (%p)", _channels[i].id, _channels[i].chan);
if(_channels[i].chan->isTerminated()) {
@@ -181,7 +181,7 @@ bool ScummMixer::handleFrame() {
bool ScummMixer::stop() {
debug(9, "ScummMixer::stop()");
- for(int i = 0; i < SoundMixer::NUM_CHANNELS; i++) {
+ for(int i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) {
if(_channels[i].id != -1) {
delete _channels[i].chan;
_channels[i].id = -1;
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 00204c8b3a..2b790799d4 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -943,7 +943,7 @@ void Sound::bundleMusicHandler(Scumm * scumm) {
if (_musicBundleToBeRemoved == true) {
_scumm->_timer->releaseProcedure(&music_handler);
_nameBundleMusic = NULL;
- _scumm->_mixer->stopChannel(_bundleMusicTrack);
+ _scumm->_mixer->stop(_bundleMusicTrack);
_bundleMusicTrack = -1;
if (_musicBundleBufFinal) {
free(_musicBundleBufFinal);
@@ -1033,8 +1033,8 @@ void Sound::bundleMusicHandler(Scumm * scumm) {
uint32 final_size = decode12BitsSample(ptr, &buffer, size);
if (_bundleMusicTrack == -1) {
- _bundleMusicTrack = _scumm->_mixer->playStream(NULL, -1, buffer, final_size, rate,
- SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_16BITS | SoundMixer::FLAG_STEREO, -1);
+ _bundleMusicTrack = _scumm->_mixer->playStream(NULL, _scumm->_mixer->_beginSlots - 1, buffer, final_size, rate,
+ SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_16BITS | SoundMixer::FLAG_STEREO, -1, 800000);
} else {
_scumm->_mixer->append(_bundleMusicTrack, buffer, final_size, rate,
SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_16BITS | SoundMixer::FLAG_STEREO);