aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sfx
diff options
context:
space:
mode:
authorFilippos Karapetis2009-12-28 22:52:07 +0000
committerFilippos Karapetis2009-12-28 22:52:07 +0000
commitdd1fc9c14bb17d2a599799ed11f124db18b3fad7 (patch)
treefb9e6439421f665951430ec2f275d33c20a85c76 /engines/sci/sfx
parentfaff5b2123c644015df213010ebd9a05cc9d1ba4 (diff)
downloadscummvm-rg350-dd1fc9c14bb17d2a599799ed11f124db18b3fad7.tar.gz
scummvm-rg350-dd1fc9c14bb17d2a599799ed11f124db18b3fad7.tar.bz2
scummvm-rg350-dd1fc9c14bb17d2a599799ed11f124db18b3fad7.zip
SCI/new music code: Implemented cmdSendMidi, and removed access to _argc from sound commands
svn-id: r46692
Diffstat (limited to 'engines/sci/sfx')
-rw-r--r--engines/sci/sfx/music.h2
-rw-r--r--engines/sci/sfx/soundcmd.cpp33
-rw-r--r--engines/sci/sfx/soundcmd.h4
3 files changed, 24 insertions, 15 deletions
diff --git a/engines/sci/sfx/music.h b/engines/sci/sfx/music.h
index c2909e1908..ddb67aaf51 100644
--- a/engines/sci/sfx/music.h
+++ b/engines/sci/sfx/music.h
@@ -162,6 +162,8 @@ public:
void enterCriticalSection() { _inCriticalSection = true; }
void leaveCriticalSection() { _inCriticalSection = false; }
+ void sendMidiCommand (uint32 cmd) { _pMidiDrv->send(cmd); }
+
#ifndef USE_OLD_MUSIC_FUNCTIONS
virtual void saveLoadWithSerializer(Common::Serializer &ser);
#endif
diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp
index 98f07dae3e..433ab38c3c 100644
--- a/engines/sci/sfx/soundcmd.cpp
+++ b/engines/sci/sfx/soundcmd.cpp
@@ -209,21 +209,29 @@ reg_t SoundCommandParser::parseCommand(int argc, reg_t *argv, reg_t acc) {
reg_t obj = (argc > 1) ? argv[1] : NULL_REG;
int16 value = (argc > 2) ? argv[2].toSint16() : 0;
_acc = acc;
- _argc = argc;
_argv = argv;
- if (argc > 5) { // for cmdSendMidi
- _midiCmd = argv[3].toUint16() == 0xff ?
+ // cmdMuteSound and cmdVolume do not operate on an object, but need the number of
+ // arguments passed. We load this in the value
+ if (obj.isNull())
+ value = argc - 1; // minus the command
+
+ if (argc == 6) { // cmdSendMidi
+ byte channel = argv[2].toUint16() & 0xf;
+ byte midiCmd = argv[3].toUint16() == 0xff ?
0xe0 : /* Pitch wheel */
0xb0; /* argv[3].toUint16() is actually a controller number */
- _controller = argv[3].toUint16();
- _param = argv[4].toUint16();
+
+ uint16 controller = argv[4].toUint16();
+ uint16 param = argv[5].toUint16();
+
+ _midiCommand = (channel | midiCmd) | ((uint32)controller << 8) | ((uint32)param << 16);
}
if (command < _soundCommands.size()) {
if (strcmp(_soundCommands[command]->desc, "cmdUpdateCues")) {
//printf("%s, object %04x:%04x\n", _soundCommands[command]->desc, PRINT_REG(obj)); // debug
- //debugC(2, kDebugLevelSound, "%s, object %04x:%04x", _soundCommands[command]->desc, PRINT_REG(obj));
+ debugC(2, kDebugLevelSound, "%s, object %04x:%04x", _soundCommands[command]->desc, PRINT_REG(obj));
}
// If the command is operating on an object of the sound list, don't allow onTimer to kick in till the
@@ -563,8 +571,8 @@ void SoundCommandParser::cmdResumeHandle(reg_t obj, int16 value) {
void SoundCommandParser::cmdMuteSound(reg_t obj, int16 value) {
#ifndef USE_OLD_MUSIC_FUNCTIONS
- if (_argc > 0)
- _music->soundSetSoundOn(_argv[0].toUint16());
+ if (value > 0)
+ _music->soundSetSoundOn(obj.toUint16());
_acc = make_reg(0, _music->soundGetSoundOn());
#endif
}
@@ -576,7 +584,7 @@ void SoundCommandParser::cmdVolume(reg_t obj, int16 value) {
_acc = make_reg(0, _state->sfx_getVolume());
#else
- if (_argc > 1)
+ if (value > 0)
_music->soundSetMasterVolume(obj.toSint16());
_acc = make_reg(0, _music->soundGetMasterVolume());
#endif
@@ -779,11 +787,10 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
void SoundCommandParser::cmdSendMidi(reg_t obj, int16 value) {
#ifdef USE_OLD_MUSIC_FUNCTIONS
- SongHandle handle = FROBNICATE_HANDLE(obj);
- _state->sfx_send_midi(handle, value, _midiCmd, _controller, _param);
+ //SongHandle handle = FROBNICATE_HANDLE(obj);
+ //_state->sfx_send_midi(handle, value, _midiCmd, _controller, _param);
#else
- // TODO: implement this...
- warning("STUB: cmdSendMidi");
+ _music->sendMidiCommand(_midiCommand);
#endif
}
diff --git a/engines/sci/sfx/soundcmd.h b/engines/sci/sfx/soundcmd.h
index b83af491b5..1d88c393fd 100644
--- a/engines/sci/sfx/soundcmd.h
+++ b/engines/sci/sfx/soundcmd.h
@@ -70,8 +70,8 @@ private:
#endif
AudioPlayer *_audio;
SciVersion _soundVersion;
- int _argc;
- reg_t *_argv;
+ reg_t *_argv; // for cmdFadeHandle
+ uint32 _midiCommand; // for cmdSendMidi
reg_t _acc;
int _midiCmd, _controller, _param;