cleanup
svn-id: r6832
This commit is contained in:
parent
e1d591921f
commit
0602882b18
7 changed files with 57 additions and 74 deletions
|
@ -106,7 +106,7 @@ struct Player {
|
||||||
// Player part
|
// Player part
|
||||||
void hook_clear();
|
void hook_clear();
|
||||||
void clear();
|
void clear();
|
||||||
bool start_sound(int sound);
|
bool startSound(int sound);
|
||||||
void uninit_parts();
|
void uninit_parts();
|
||||||
byte *parse_midi(byte *s);
|
byte *parse_midi(byte *s);
|
||||||
void key_off(uint8 chan, byte data);
|
void key_off(uint8 chan, byte data);
|
||||||
|
@ -455,12 +455,12 @@ public:
|
||||||
int set_master_volume(uint vol);
|
int set_master_volume(uint vol);
|
||||||
int get_master_volume();
|
int get_master_volume();
|
||||||
byte get_channel_program (byte channel) { return _driver->get_channel_program (channel); }
|
byte get_channel_program (byte channel) { return _driver->get_channel_program (channel); }
|
||||||
bool start_sound(int sound);
|
bool startSound(int sound);
|
||||||
int stop_sound(int sound);
|
int stopSound(int sound);
|
||||||
int stop_all_sounds();
|
int stop_all_sounds();
|
||||||
int get_sound_status(int sound);
|
int get_sound_status(int sound);
|
||||||
bool get_sound_active(int sound);
|
bool get_sound_active(int sound);
|
||||||
int32 do_command(int a, int b, int c, int d, int e, int f, int g, int h);
|
int32 doCommand(int a, int b, int c, int d, int e, int f, int g, int h);
|
||||||
int clear_queue();
|
int clear_queue();
|
||||||
void setBase(byte **base);
|
void setBase(byte **base);
|
||||||
|
|
||||||
|
@ -676,7 +676,7 @@ bool IMuseInternal::isGM(int sound) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IMuseInternal::start_sound(int sound) {
|
bool IMuseInternal::startSound(int sound) {
|
||||||
Player *player;
|
Player *player;
|
||||||
void *mdhd;
|
void *mdhd;
|
||||||
|
|
||||||
|
@ -697,7 +697,7 @@ bool IMuseInternal::start_sound(int sound) {
|
||||||
if (!mdhd) {
|
if (!mdhd) {
|
||||||
mdhd = findTag(sound, MDPG_TAG, 0);
|
mdhd = findTag(sound, MDPG_TAG, 0);
|
||||||
if (!mdhd) {
|
if (!mdhd) {
|
||||||
warning("SE::start_sound failed: Couldn't find sound %d", sound);
|
warning("SE::startSound failed: Couldn't find sound %d", sound);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -720,7 +720,7 @@ bool IMuseInternal::start_sound(int sound) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
player->clear();
|
player->clear();
|
||||||
return player->start_sound(sound);
|
return player->startSound(sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -789,7 +789,7 @@ void IMuseInternal::init_parts() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int IMuseInternal::stop_sound(int sound) {
|
int IMuseInternal::stopSound(int sound) {
|
||||||
Player *player = _players;
|
Player *player = _players;
|
||||||
int i;
|
int i;
|
||||||
int r = -1;
|
int r = -1;
|
||||||
|
@ -865,7 +865,7 @@ void IMuseInternal::handle_marker(uint id, byte data) {
|
||||||
break;
|
break;
|
||||||
_queue_end = pos;
|
_queue_end = pos;
|
||||||
|
|
||||||
do_command(p[0], p[1], p[2], p[3], p[4], p[5], p[6], 0);
|
doCommand(p[0], p[1], p[2], p[3], p[4], p[5], p[6], 0);
|
||||||
|
|
||||||
if (_queue_cleared)
|
if (_queue_cleared)
|
||||||
return;
|
return;
|
||||||
|
@ -1242,7 +1242,7 @@ int IMuseInternal::enqueue_trigger(int sound, int marker) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 IMuseInternal::do_command(int a, int b, int c, int d, int e, int f, int g, int h) {
|
int32 IMuseInternal::doCommand(int a, int b, int c, int d, int e, int f, int g, int h) {
|
||||||
int i;
|
int i;
|
||||||
byte cmd = a & 0xFF;
|
byte cmd = a & 0xFF;
|
||||||
byte param = a >> 8;
|
byte param = a >> 8;
|
||||||
|
@ -1261,9 +1261,9 @@ int32 IMuseInternal::do_command(int a, int b, int c, int d, int e, int f, int g,
|
||||||
case 7:
|
case 7:
|
||||||
return _master_volume >> 1; // Convert from 0-255 to 0-127
|
return _master_volume >> 1; // Convert from 0-255 to 0-127
|
||||||
case 8:
|
case 8:
|
||||||
return start_sound(b) ? 0 : -1;
|
return startSound(b) ? 0 : -1;
|
||||||
case 9:
|
case 9:
|
||||||
return stop_sound(b);
|
return stopSound(b);
|
||||||
case 10: // FIXME: Sam and Max - Not sure if this is correct
|
case 10: // FIXME: Sam and Max - Not sure if this is correct
|
||||||
return stop_all_sounds();
|
return stop_all_sounds();
|
||||||
case 11:
|
case 11:
|
||||||
|
@ -1282,7 +1282,7 @@ int32 IMuseInternal::do_command(int a, int b, int c, int d, int e, int f, int g,
|
||||||
// Set player volume.
|
// Set player volume.
|
||||||
return player->set_vol (e);
|
return player->set_vol (e);
|
||||||
default:
|
default:
|
||||||
warning("IMuseInternal::do_command (6) unsupported sub-command %d", d);
|
warning("IMuseInternal::doCommand (6) unsupported sub-command %d", d);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
case 13:
|
case 13:
|
||||||
|
@ -1348,13 +1348,13 @@ int32 IMuseInternal::do_command(int a, int b, int c, int d, int e, int f, int g,
|
||||||
// Sam & Max: Deferred Command
|
// Sam & Max: Deferred Command
|
||||||
// FIXME: Right now this acts as an immediate command.
|
// FIXME: Right now this acts as an immediate command.
|
||||||
// The significance of parameter b is unknown.
|
// The significance of parameter b is unknown.
|
||||||
warning ("Incomplete support for iMuse::do_command(20)");
|
warning ("Incomplete support for iMuse::doCommand(20)");
|
||||||
return do_command (c, d, e, f, g, h, 0, 0);
|
return doCommand (c, d, e, f, g, h, 0, 0);
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
warning("do_command (%d [%d/%d], %d, %d, %d, %d, %d, %d, %d) unsupported", a, param, cmd, b, c, d, e, f, g, h);
|
warning("doCommand (%d [%d/%d], %d, %d, %d, %d, %d, %d, %d) unsupported", a, param, cmd, b, c, d, e, f, g, h);
|
||||||
}
|
}
|
||||||
} else if (param == 1) {
|
} else if (param == 1) {
|
||||||
if ((1 << cmd) & (0x783FFF)) {
|
if ((1 << cmd) & (0x783FFF)) {
|
||||||
|
@ -1435,7 +1435,7 @@ int32 IMuseInternal::do_command(int a, int b, int c, int d, int e, int f, int g,
|
||||||
case 24:
|
case 24:
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
warning("do_command (%d [%d/%d], %d, %d, %d, %d, %d, %d, %d) unsupported", a, param, cmd, b, c, d, e, f, g, h);
|
warning("doCommand (%d [%d/%d], %d, %d, %d, %d, %d, %d, %d) unsupported", a, param, cmd, b, c, d, e, f, g, h);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1446,7 +1446,7 @@ int32 IMuseInternal::do_command(int a, int b, int c, int d, int e, int f, int g,
|
||||||
int32 IMuseInternal::ImSetTrigger (int sound, int id, int a, int b, int c, int d) {
|
int32 IMuseInternal::ImSetTrigger (int sound, int id, int a, int b, int c, int d) {
|
||||||
// Sam & Max: ImSetTrigger.
|
// Sam & Max: ImSetTrigger.
|
||||||
// Sets a trigger for a particular player and
|
// Sets a trigger for a particular player and
|
||||||
// marker ID, along with do_command parameters
|
// marker ID, along with doCommand parameters
|
||||||
// to invoke at the marker. The marker is
|
// to invoke at the marker. The marker is
|
||||||
// represented by MIDI SysEx block 00 xx (F7)
|
// represented by MIDI SysEx block 00 xx (F7)
|
||||||
// where "xx" is the marker ID.
|
// where "xx" is the marker ID.
|
||||||
|
@ -1491,7 +1491,7 @@ int32 IMuseInternal::ImSetTrigger (int sound, int id, int a, int b, int c, int d
|
||||||
// If the command is to start a sound, stop that sound if it's already playing.
|
// If the command is to start a sound, stop that sound if it's already playing.
|
||||||
// This fixes some carnival music problems.
|
// This fixes some carnival music problems.
|
||||||
if (trig->command [0] == 8 && get_sound_status (trig->command [1]))
|
if (trig->command [0] == 8 && get_sound_status (trig->command [1]))
|
||||||
stop_sound (trig->command [1]);
|
stopSound (trig->command [1]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1754,14 +1754,14 @@ void Player::clear() {
|
||||||
_ticks_per_beat = TICKS_PER_BEAT;
|
_ticks_per_beat = TICKS_PER_BEAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::start_sound(int sound) {
|
bool Player::startSound(int sound) {
|
||||||
void *mdhd;
|
void *mdhd;
|
||||||
|
|
||||||
mdhd = _se->findTag(sound, MDHD_TAG, 0);
|
mdhd = _se->findTag(sound, MDHD_TAG, 0);
|
||||||
if (mdhd == NULL) {
|
if (mdhd == NULL) {
|
||||||
mdhd = _se->findTag(sound, MDPG_TAG, 0);
|
mdhd = _se->findTag(sound, MDPG_TAG, 0);
|
||||||
if (mdhd == NULL) {
|
if (mdhd == NULL) {
|
||||||
warning("P::start_sound failed: Couldn't find %s", MDHD_TAG);
|
warning("P::startSound failed: Couldn't find %s", MDHD_TAG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2062,7 +2062,7 @@ void Player::parse_sysex(byte *p, uint len) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Sam & Max: Trigger Event
|
// Sam & Max: Trigger Event
|
||||||
// Triggers are set by do_command (ImSetTrigger).
|
// Triggers are set by doCommand (ImSetTrigger).
|
||||||
// When a SysEx marker is encountered whose sound
|
// When a SysEx marker is encountered whose sound
|
||||||
// ID and marker ID match what was set by ImSetTrigger,
|
// ID and marker ID match what was set by ImSetTrigger,
|
||||||
// something magical is supposed to happen....
|
// something magical is supposed to happen....
|
||||||
|
@ -2071,7 +2071,7 @@ void Player::parse_sysex(byte *p, uint len) {
|
||||||
_se->_snm_triggers [a].id == *p)
|
_se->_snm_triggers [a].id == *p)
|
||||||
{
|
{
|
||||||
_se->_snm_triggers [a].sound = _se->_snm_triggers [a].id = 0;
|
_se->_snm_triggers [a].sound = _se->_snm_triggers [a].id = 0;
|
||||||
_se->do_command (_se->_snm_triggers [a].command [0],
|
_se->doCommand (_se->_snm_triggers [a].command [0],
|
||||||
_se->_snm_triggers [a].command [1],
|
_se->_snm_triggers [a].command [1],
|
||||||
_se->_snm_triggers [a].command [2],
|
_se->_snm_triggers [a].command [2],
|
||||||
_se->_snm_triggers [a].command [3],
|
_se->_snm_triggers [a].command [3],
|
||||||
|
@ -3551,12 +3551,12 @@ int IMuse::set_music_volume(uint vol) { in(); int ret = _target->set_music_volum
|
||||||
int IMuse::get_music_volume() { in(); int ret = _target->get_music_volume(); out(); return ret; }
|
int IMuse::get_music_volume() { in(); int ret = _target->get_music_volume(); out(); return ret; }
|
||||||
int IMuse::set_master_volume(uint vol) { in(); int ret = _target->set_master_volume (vol); out(); return ret; }
|
int IMuse::set_master_volume(uint vol) { in(); int ret = _target->set_master_volume (vol); out(); return ret; }
|
||||||
int IMuse::get_master_volume() { in(); int ret = _target->get_master_volume(); out(); return ret; }
|
int IMuse::get_master_volume() { in(); int ret = _target->get_master_volume(); out(); return ret; }
|
||||||
bool IMuse::start_sound(int sound) { in(); bool ret = _target->start_sound (sound); out(); return ret; }
|
bool IMuse::startSound(int sound) { in(); bool ret = _target->startSound (sound); out(); return ret; }
|
||||||
int IMuse::stop_sound(int sound) { in(); int ret = _target->stop_sound (sound); out(); return ret; }
|
int IMuse::stopSound(int sound) { in(); int ret = _target->stopSound (sound); out(); return ret; }
|
||||||
int IMuse::stop_all_sounds() { in(); int ret = _target->stop_all_sounds(); out(); return ret; }
|
int IMuse::stop_all_sounds() { in(); int ret = _target->stop_all_sounds(); out(); return ret; }
|
||||||
int IMuse::get_sound_status(int sound) { in(); int ret = _target->get_sound_status (sound); out(); return ret; }
|
int IMuse::get_sound_status(int sound) { in(); int ret = _target->get_sound_status (sound); out(); return ret; }
|
||||||
bool IMuse::get_sound_active(int sound) { in(); bool ret = _target->get_sound_active (sound); out(); return ret; }
|
bool IMuse::get_sound_active(int sound) { in(); bool ret = _target->get_sound_active (sound); out(); return ret; }
|
||||||
int32 IMuse::do_command(int a, int b, int c, int d, int e, int f, int g, int h) { in(); int32 ret = _target->do_command (a,b,c,d,e,f,g,h); out(); return ret; }
|
int32 IMuse::doCommand(int a, int b, int c, int d, int e, int f, int g, int h) { in(); int32 ret = _target->doCommand (a,b,c,d,e,f,g,h); out(); return ret; }
|
||||||
int IMuse::clear_queue() { in(); int ret = _target->clear_queue(); out(); return ret; }
|
int IMuse::clear_queue() { in(); int ret = _target->clear_queue(); out(); return ret; }
|
||||||
void IMuse::setBase(byte **base) { in(); _target->setBase (base); out(); }
|
void IMuse::setBase(byte **base) { in(); _target->setBase (base); out(); }
|
||||||
uint32 IMuse::property(int prop, uint32 value) { in(); uint32 ret = _target->property (prop, value); out(); return ret; }
|
uint32 IMuse::property(int prop, uint32 value) { in(); uint32 ret = _target->property (prop, value); out(); return ret; }
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
#ifndef IMUSE_H
|
#ifndef IMUSE_H
|
||||||
#define IMUSE_H
|
#define IMUSE_H
|
||||||
|
|
||||||
#include "imuse_digi.h"
|
|
||||||
|
|
||||||
class IMuseInternal;
|
class IMuseInternal;
|
||||||
class MidiDriver;
|
class MidiDriver;
|
||||||
class OSystem;
|
class OSystem;
|
||||||
|
@ -56,12 +54,12 @@ public:
|
||||||
int get_music_volume();
|
int get_music_volume();
|
||||||
int set_master_volume(uint vol);
|
int set_master_volume(uint vol);
|
||||||
int get_master_volume();
|
int get_master_volume();
|
||||||
bool start_sound(int sound);
|
bool startSound(int sound);
|
||||||
int stop_sound(int sound);
|
int stopSound(int sound);
|
||||||
int stop_all_sounds();
|
int stop_all_sounds();
|
||||||
int get_sound_status(int sound);
|
int get_sound_status(int sound);
|
||||||
bool get_sound_active(int sound);
|
bool get_sound_active(int sound);
|
||||||
int32 do_command(int a, int b, int c, int d, int e, int f, int g, int h);
|
int32 doCommand(int a, int b, int c, int d, int e, int f, int g, int h);
|
||||||
int clear_queue();
|
int clear_queue();
|
||||||
void setBase(byte **base);
|
void setBase(byte **base);
|
||||||
uint32 property(int prop, uint32 value);
|
uint32 property(int prop, uint32 value);
|
||||||
|
|
|
@ -24,13 +24,13 @@
|
||||||
#include "actor.h"
|
#include "actor.h"
|
||||||
#include "charset.h"
|
#include "charset.h"
|
||||||
#include "imuse.h"
|
#include "imuse.h"
|
||||||
|
#include "imuse_digi.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "saveload.h"
|
#include "saveload.h"
|
||||||
#include "scumm.h"
|
#include "scumm.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "verbs.h"
|
#include "verbs.h"
|
||||||
#include "common/config-file.h"
|
#include "common/config-file.h"
|
||||||
#include "sound/mididrv.h"
|
|
||||||
|
|
||||||
struct SaveGameHeader {
|
struct SaveGameHeader {
|
||||||
uint32 type;
|
uint32 type;
|
||||||
|
|
|
@ -2604,8 +2604,7 @@ void Scumm_v6::o6_kernelSetFunctions() {
|
||||||
case 122:
|
case 122:
|
||||||
|
|
||||||
_vars[VAR_SOUNDRESULT] =
|
_vars[VAR_SOUNDRESULT] =
|
||||||
(short)_imuse->do_command(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]
|
(short)_imuse->doCommand(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 123:
|
case 123:
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
#include "dialogs.h"
|
#include "dialogs.h"
|
||||||
#include "imuse.h"
|
#include "imuse.h"
|
||||||
|
#include "imuse_digi.h"
|
||||||
#include "intern.h"
|
#include "intern.h"
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "scumm/scumm.h"
|
#include "scumm/scumm.h"
|
||||||
#include "scumm/sound.h"
|
#include "scumm/sound.h"
|
||||||
#include "scumm/imuse.h"
|
#include "scumm/imuse.h"
|
||||||
|
#include "scumm/imuse_digi.h"
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
#include "smush_player.h"
|
#include "smush_player.h"
|
||||||
#include "smush_mixer.h"
|
#include "smush_mixer.h"
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "sound/mididrv.h"
|
#include "sound/mididrv.h"
|
||||||
#include "imuse.h"
|
#include "imuse.h"
|
||||||
|
#include "imuse_digi.h"
|
||||||
#include "actor.h"
|
#include "actor.h"
|
||||||
#include "bundle.h"
|
#include "bundle.h"
|
||||||
#include "common/config-file.h"
|
#include "common/config-file.h"
|
||||||
|
@ -71,10 +72,8 @@ void Sound::addSoundToQueue2(int sound) {
|
||||||
|
|
||||||
void Sound::processSoundQues() {
|
void Sound::processSoundQues() {
|
||||||
int d;
|
int d;
|
||||||
int i, j;
|
|
||||||
int num;
|
int num;
|
||||||
int16 data[16];
|
int16 data[16];
|
||||||
IMuse *se;
|
|
||||||
|
|
||||||
processSfxQueues();
|
processSfxQueues();
|
||||||
|
|
||||||
|
@ -84,21 +83,18 @@ void Sound::processSoundQues() {
|
||||||
playSound(d);
|
playSound(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < _soundQuePos;) {
|
for (int i = 0; i < _soundQuePos;) {
|
||||||
num = _soundQue[i++];
|
num = _soundQue[i++];
|
||||||
if (i + num > _soundQuePos) {
|
if (i + num > _soundQuePos) {
|
||||||
warning("processSoundQues: invalid num value");
|
warning("processSoundQues: invalid num value");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (j = 0; j < 16; j++)
|
memset(data, 0, sizeof(data));
|
||||||
data[j] = 0;
|
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
for (j = 0; j < num; j++)
|
for (int j = 0; j < num; j++)
|
||||||
data[j] = _soundQue[i + j];
|
data[j] = _soundQue[i + j];
|
||||||
i += num;
|
i += num;
|
||||||
|
|
||||||
se = _scumm->_imuse;
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
debug(1, "processSoundQues(%d,%d,%d,%d,%d,%d,%d,%d,%d)",
|
debug(1, "processSoundQues(%d,%d,%d,%d,%d,%d,%d,%d,%d)",
|
||||||
data[0] >> 8,
|
data[0] >> 8,
|
||||||
|
@ -108,9 +104,9 @@ void Sound::processSoundQues() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!(_scumm->_features & GF_AFTER_V7)) {
|
if (!(_scumm->_features & GF_AFTER_V7)) {
|
||||||
if (se)
|
if (_scumm->_imuse)
|
||||||
_scumm->_vars[_scumm->VAR_SOUNDRESULT] =
|
_scumm->_vars[_scumm->VAR_SOUNDRESULT] =
|
||||||
(short)se->do_command(data[0], data[1], data[2], data[3], data[4],
|
(short)_scumm->_imuse->doCommand(data[0], data[1], data[2], data[3], data[4],
|
||||||
data[5], data[6], data[7]);
|
data[5], data[6], data[7]);
|
||||||
} else {
|
} else {
|
||||||
if (_scumm->_imuseDigital)
|
if (_scumm->_imuseDigital)
|
||||||
|
@ -180,8 +176,7 @@ void Sound::playSound(int soundID) {
|
||||||
int size;
|
int size;
|
||||||
int rate;
|
int rate;
|
||||||
|
|
||||||
debug(3,"playSound #%d (room %d)",
|
debug(3,"playSound #%d (room %d)", soundID, _scumm->getResourceRoomNr(rtSound, soundID));
|
||||||
soundID, _scumm->getResourceRoomNr(rtSound, soundID));
|
|
||||||
ptr = _scumm->getResourceAddress(rtSound, soundID);
|
ptr = _scumm->getResourceAddress(rtSound, soundID);
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
if (READ_UINT32_UNALIGNED(ptr) == MKID('iMUS')){
|
if (READ_UINT32_UNALIGNED(ptr) == MKID('iMUS')){
|
||||||
|
@ -396,10 +391,9 @@ void Sound::playSound(int soundID) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IMuse *se = _scumm->_imuse;
|
if (_scumm->_imuse) {
|
||||||
if (se) {
|
|
||||||
_scumm->getResourceAddress(rtSound, soundID);
|
_scumm->getResourceAddress(rtSound, soundID);
|
||||||
se->start_sound(soundID);
|
_scumm->_imuse->startSound(soundID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,7 +451,7 @@ void Sound::processSfxQueues() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int compar(const void *a, const void *b) {
|
static int compareMP3OffsetTable(const void *a, const void *b) {
|
||||||
return ((MP3OffsetTable *)a)->org_offset - ((MP3OffsetTable *)b)->org_offset;
|
return ((MP3OffsetTable *)a)->org_offset - ((MP3OffsetTable *)b)->org_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,7 +504,7 @@ int Sound::startTalkSound(uint32 offset, uint32 b, int mode) {
|
||||||
|
|
||||||
key.org_offset = offset;
|
key.org_offset = offset;
|
||||||
result = (MP3OffsetTable *)bsearch(&key, offset_table, num_sound_effects,
|
result = (MP3OffsetTable *)bsearch(&key, offset_table, num_sound_effects,
|
||||||
sizeof(MP3OffsetTable), compar);
|
sizeof(MP3OffsetTable), compareMP3OffsetTable);
|
||||||
|
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
warning("startTalkSound: did not find sound at offset %d !", offset);
|
warning("startTalkSound: did not find sound at offset %d !", offset);
|
||||||
|
@ -573,7 +567,6 @@ bool Sound::isMouthSyncOff(uint pos) {
|
||||||
|
|
||||||
|
|
||||||
int Sound::isSoundRunning(int sound) {
|
int Sound::isSoundRunning(int sound) {
|
||||||
IMuse *se;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (sound == _scumm->current_cd_sound)
|
if (sound == _scumm->current_cd_sound)
|
||||||
|
@ -595,10 +588,9 @@ int Sound::isSoundRunning(int sound) {
|
||||||
return _scumm->_imuseDigital->getSoundStatus(sound);
|
return _scumm->_imuseDigital->getSoundStatus(sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
se = _scumm->_imuse;
|
if (!_scumm->_imuse)
|
||||||
if (!se)
|
|
||||||
return 0;
|
return 0;
|
||||||
return se->get_sound_status(sound);
|
return _scumm->_imuse->get_sound_status(sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is exactly the same as isSoundRunning except that it
|
// This is exactly the same as isSoundRunning except that it
|
||||||
|
@ -606,7 +598,6 @@ int Sound::isSoundRunning(int sound) {
|
||||||
// This is necessary when determining what resources to
|
// This is necessary when determining what resources to
|
||||||
// expire from memory.
|
// expire from memory.
|
||||||
bool Sound::isSoundActive(int sound) {
|
bool Sound::isSoundActive(int sound) {
|
||||||
IMuse *se;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (sound == _scumm->current_cd_sound)
|
if (sound == _scumm->current_cd_sound)
|
||||||
|
@ -628,10 +619,9 @@ bool Sound::isSoundActive(int sound) {
|
||||||
return _scumm->_imuseDigital->getSoundStatus(sound) != 0;
|
return _scumm->_imuseDigital->getSoundStatus(sound) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
se = _scumm->_imuse;
|
if (!_scumm->_imuse)
|
||||||
if (!se)
|
|
||||||
return false;
|
return false;
|
||||||
return se->get_sound_active(sound);
|
return _scumm->_imuse->get_sound_active(sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sound::isSoundInQueue(int sound) {
|
bool Sound::isSoundInQueue(int sound) {
|
||||||
|
@ -655,7 +645,6 @@ bool Sound::isSoundInQueue(int sound) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::stopSound(int a) {
|
void Sound::stopSound(int a) {
|
||||||
IMuse *se;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (a != 0 && a == _scumm->current_cd_sound) {
|
if (a != 0 && a == _scumm->current_cd_sound) {
|
||||||
|
@ -665,10 +654,8 @@ void Sound::stopSound(int a) {
|
||||||
|
|
||||||
if (_scumm->_imuseDigital) {
|
if (_scumm->_imuseDigital) {
|
||||||
_scumm->_imuseDigital->stopSound(a);
|
_scumm->_imuseDigital->stopSound(a);
|
||||||
} else {
|
} else if (_scumm->_imuse) {
|
||||||
se = _scumm->_imuse;
|
_scumm->_imuse->stopSound(a);
|
||||||
if (se)
|
|
||||||
se->stop_sound(a);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 10; i++)
|
for (i = 0; i < 10; i++)
|
||||||
|
@ -677,16 +664,14 @@ void Sound::stopSound(int a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::stopAllSounds() {
|
void Sound::stopAllSounds() {
|
||||||
IMuse *se = _scumm->_imuse;
|
|
||||||
|
|
||||||
if (_scumm->current_cd_sound != 0) {
|
if (_scumm->current_cd_sound != 0) {
|
||||||
_scumm->current_cd_sound = 0;
|
_scumm->current_cd_sound = 0;
|
||||||
stopCD();
|
stopCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (se) {
|
if (_scumm->_imuse) {
|
||||||
se->stop_all_sounds();
|
_scumm->_imuse->stop_all_sounds();
|
||||||
se->clear_queue();
|
_scumm->_imuse->clear_queue();
|
||||||
}
|
}
|
||||||
clearSoundQue();
|
clearSoundQue();
|
||||||
stopSfxSound();
|
stopSfxSound();
|
||||||
|
@ -706,7 +691,7 @@ void Sound::soundKludge(int *list, int num) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((_soundQuePos + num) > 0x100) {
|
if ((_soundQuePos + num) > 0x100) {
|
||||||
warning("Sound que buffer overflow");
|
warning("Sound que buffer overflow (%d + %d = %d)", _soundQuePos, num, _soundQuePos+num);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,9 +739,8 @@ void Sound::setupSound() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::pauseSounds(bool pause) {
|
void Sound::pauseSounds(bool pause) {
|
||||||
IMuse *se = _scumm->_imuse;
|
if (_scumm->_imuse)
|
||||||
if (se)
|
_scumm->_imuse->pause(pause);
|
||||||
se->pause(pause);
|
|
||||||
|
|
||||||
// Don't pause sounds if the game isn't active
|
// Don't pause sounds if the game isn't active
|
||||||
// FIXME - this is quite a nasty hack, replace with something cleaner, and w/o
|
// FIXME - this is quite a nasty hack, replace with something cleaner, and w/o
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue