[Scummvm-cvs-logs] SF.net SVN: scummvm:[46692] scummvm/trunk/engines/sci/sfx
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Mon Dec 28 23:52:07 CET 2009
Revision: 46692
http://scummvm.svn.sourceforge.net/scummvm/?rev=46692&view=rev
Author: thebluegr
Date: 2009-12-28 22:52:07 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
SCI/new music code: Implemented cmdSendMidi, and removed access to _argc from sound commands
Modified Paths:
--------------
scummvm/trunk/engines/sci/sfx/music.h
scummvm/trunk/engines/sci/sfx/soundcmd.cpp
scummvm/trunk/engines/sci/sfx/soundcmd.h
Modified: scummvm/trunk/engines/sci/sfx/music.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/music.h 2009-12-28 22:45:26 UTC (rev 46691)
+++ scummvm/trunk/engines/sci/sfx/music.h 2009-12-28 22:52:07 UTC (rev 46692)
@@ -162,6 +162,8 @@
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
Modified: scummvm/trunk/engines/sci/sfx/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/soundcmd.cpp 2009-12-28 22:45:26 UTC (rev 46691)
+++ scummvm/trunk/engines/sci/sfx/soundcmd.cpp 2009-12-28 22:52:07 UTC (rev 46692)
@@ -209,21 +209,29 @@
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::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 @@
_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::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
}
Modified: scummvm/trunk/engines/sci/sfx/soundcmd.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/soundcmd.h 2009-12-28 22:45:26 UTC (rev 46691)
+++ scummvm/trunk/engines/sci/sfx/soundcmd.h 2009-12-28 22:52:07 UTC (rev 46692)
@@ -70,8 +70,8 @@
#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;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list