ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

lua_v2_sound.cpp

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #include "audio/mixer.h"
00024 #include "audio/audiostream.h"
00025 #include "common/system.h"
00026 #include "engines/grim/set.h"
00027 
00028 #include "engines/grim/emi/sound/emisound.h"
00029 #include "engines/grim/emi/lua_v2.h"
00030 #include "engines/grim/emi/poolsound.h"
00031 #include "engines/grim/lua/lua.h"
00032 
00033 #include "engines/grim/debug.h"
00034 #include "engines/grim/sound.h"
00035 #include "engines/grim/grim.h"
00036 #include "engines/grim/resource.h"
00037 
00038 namespace Grim {
00039 
00040 // Helper function, not called from LUA directly
00041 uint Lua_V2::convertEmiVolumeToMixer(uint emiVolume) {
00042     // EmiVolume range: 0 .. 100
00043     // Mixer range: 0 .. kMaxChannelVolume
00044     float vol = float(emiVolume) / MAX_EMI_VOLUME * Audio::Mixer::kMaxChannelVolume;
00045     return CLIP<uint>(uint(vol), 0, Audio::Mixer::kMaxChannelVolume);
00046 }
00047 
00048 // Helper function, not called from LUA directly
00049 uint Lua_V2::convertMixerVolumeToEmi(uint volume) {
00050     float vol = float(volume) * MAX_EMI_VOLUME / Audio::Mixer::kMaxChannelVolume;
00051     return CLIP<uint>(uint(vol), 0, MAX_EMI_VOLUME);
00052 }
00053 
00054 // Note: debug output for volume values uses the engine's mixer range
00055 
00056 void Lua_V2::ImGetMillisecondPosition() {
00057     lua_Object soundObj = lua_getparam(1);
00058 
00059     if (lua_isnumber(soundObj)) {
00060         int sound = (int)lua_getnumber(soundObj);
00061         // FIXME int ms = func(sound);
00062         // lua_pushnumber(ms);
00063         // push -1 for now
00064         // Currently a bit of guesswork, and probably wrong, as the stateId
00065         // is ignored by emisound (which only has one music-track now).
00066         uint32 msPos = g_emiSound->getMsPos(sound);
00067         Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImGetMillisecondPosition: sound: %d ms: %d", sound, msPos);
00068         lua_pushnumber(msPos);
00069     }
00070 }
00071 
00072 void Lua_V2::SetReverb() {
00073     lua_Object eaxObj = lua_getparam(1);
00074     lua_Object decayObj = lua_getparam(2);
00075     lua_Object mixObj = lua_getparam(3);
00076     lua_Object predelayObj = lua_getparam(4);
00077     lua_Object dampingObj = lua_getparam(5);
00078 
00079     if (!lua_isnumber(eaxObj))
00080         return;
00081 
00082     int eax = (int)lua_getnumber(eaxObj);
00083     int param = 0;
00084     float decay = -1;
00085     float mix = -1;
00086     float predelay = -1;
00087     float damping = -1;
00088 
00089     if (eax == 60) {
00090         param = 26;
00091     } else if (eax == 70) {
00092         param = 27;
00093     } else if (eax >= 0 && eax <= 25) {
00094         param = eax;
00095         // there is some table, initialy is like eax
00096     } else {
00097         return;
00098     }
00099 
00100     if (lua_isnumber(decayObj))
00101         decay = lua_getnumber(decayObj);
00102     if (lua_isnumber(mixObj))
00103         mix = lua_getnumber(mixObj);
00104     if (lua_isnumber(predelayObj))
00105         predelay = lua_getnumber(predelayObj);
00106     if (lua_isnumber(dampingObj))
00107         damping = lua_getnumber(dampingObj);
00108 
00109     Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::SetReverb, eax: %d, decay: %f, mix: %f, predelay: %f, damping: %f", param, decay, mix, predelay, damping);
00110     // FIXME: func(param, decay, mix, predelay, damping);
00111 }
00112 
00113 void Lua_V2::ImSetState() {
00114     lua_Object stateObj = lua_getparam(1);
00115     if (!lua_isnumber(stateObj))
00116         return;
00117 
00118     int state = (int)lua_getnumber(stateObj);
00119     g_imuseState = state;
00120     Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSetState: stub, state: %d", state);
00121 }
00122 
00123 void Lua_V2::ImStateHasEnded() {
00124     lua_Object stateObj = lua_getparam(1);
00125     if (!lua_isnumber(stateObj))
00126         return;
00127 
00128     int state = (int)lua_getnumber(stateObj);
00129 
00130     pushbool(g_emiSound->stateHasEnded(state));
00131 
00132     Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImStateHasEnded: state %d.", state);
00133 }
00134 
00135 // TODO: Implement this:
00136 void Lua_V2::ImStateHasLooped() {
00137     lua_Object stateObj = lua_getparam(1);
00138     if (!lua_isnumber(stateObj))
00139         return;
00140 
00141     int state = (int)lua_getnumber(stateObj);
00142 
00143     pushbool(g_emiSound->stateHasLooped(state));
00144 }
00145 
00146 void Lua_V2::EnableVoiceFX() {
00147     lua_Object stateObj = lua_getparam(1);
00148 
00149     bool state = false;
00150     if (!lua_isnil(stateObj))
00151         state = true;
00152 
00153     // FIXME: func(state);
00154     Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::EnableVoiceFX: implement opcode, state: %d", (int)state);
00155 }
00156 
00157 void Lua_V2::SetGroupVolume() {
00158     lua_Object groupObj = lua_getparam(1);
00159     lua_Object volumeObj = lua_getparam(2);
00160 
00161     if (!lua_isnumber(groupObj))
00162         return;
00163     int group = (int)lua_getnumber(groupObj);
00164 
00165     int volume = Audio::Mixer::kMaxChannelVolume;
00166     if (lua_isnumber(volumeObj))
00167         volume = convertEmiVolumeToMixer((int)lua_getnumber(volumeObj));
00168 
00169     switch (group) {
00170         case 1: // SFX
00171             g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volume);
00172             g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, volume);
00173             break;
00174         case 2: // Voice
00175             g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, volume);
00176             break;
00177         case 3: // Music
00178             g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, volume);
00179             break;
00180         default:
00181             error("Lua_V2::SetGroupVolume - unknown group %d", group);
00182     }
00183     // FIXME: func(group, volume);
00184     Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::SetGroupVolume: group: %d, volume %d", group, volume);
00185 }
00186 
00187 void Lua_V2::EnableAudioGroup() {
00188     lua_Object groupObj = lua_getparam(1);
00189     lua_Object stateObj = lua_getparam(2);
00190 
00191     if (!lua_isnumber(groupObj))
00192         return;
00193     int group = (int)lua_getnumber(groupObj);
00194 
00195     bool state = false;
00196     if (!lua_isnil(stateObj))
00197         state = true;
00198 
00199     // FIXME: func(group, state);
00200     switch (group) {
00201         case 1: // SFX
00202             g_system->getMixer()->muteSoundType(Audio::Mixer::kSFXSoundType, !state);
00203             g_system->getMixer()->muteSoundType(Audio::Mixer::kPlainSoundType, !state);
00204             break;
00205         case 2: // Voice
00206             g_system->getMixer()->muteSoundType(Audio::Mixer::kSpeechSoundType, !state);
00207             break;
00208         case 3: // Music
00209             g_system->getMixer()->muteSoundType(Audio::Mixer::kMusicSoundType, !state);
00210             break;
00211         default:
00212             error("Lua_V2::EnableAudioGroup - unknown group %d", group);
00213     }
00214 
00215     Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::EnableAudioGroup: group: %d, state %d", group, (int)state);
00216 }
00217 
00218 void Lua_V2::ImSelectSet() {
00219     lua_Object qualityObj = lua_getparam(1);
00220 
00221     if (lua_isnumber(qualityObj)) {
00222         int quality = (int)lua_getnumber(qualityObj);
00223         // FIXME: func(quality);
00224         g_emiSound->selectMusicSet(quality);
00225         Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSelectSet: quality mode: %d", quality);
00226     }
00227 }
00228 
00229 void Lua_V2::ImFlushStack() {
00230     // FIXME
00231     Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImFlushStack: currently guesswork");
00232     g_emiSound->flushStack();
00233 }
00234 
00235 static Common::String addSoundSuffix(const char *fname) {
00236     Common::String filename = fname;
00237     if (!(g_grim->getGameFlags() & ADGF_DEMO)) {
00238         if (g_grim->getGamePlatform() == Common::kPlatformPS2) {
00239             filename += ".scx";
00240         } else {
00241             if (!filename.hasSuffix(".aif") && !filename.hasSuffix(".AIF")) {
00242                 filename += ".aif";
00243             }
00244         }
00245     }
00246     return filename;
00247 }
00248 
00249 
00250 void Lua_V2::LoadSound() {
00251     lua_Object strObj = lua_getparam(1);
00252 
00253     if (!lua_isstring(strObj))
00254         return;
00255 
00256     const char *str = lua_getstring(strObj);
00257 
00258     Common::String filename = addSoundSuffix(str);
00259 
00260     PoolSound *sound = new PoolSound(filename);
00261     lua_pushusertag(sound->getId(), MKTAG('A', 'I', 'F', 'F'));
00262 }
00263 
00264 void Lua_V2::FreeSound() {
00265     lua_Object idObj = lua_getparam(1);
00266     if (!lua_isuserdata(idObj) || lua_tag(idObj) != MKTAG('A', 'I', 'F', 'F'))
00267         return;
00268     PoolSound *sound = PoolSound::getPool().getObject(lua_getuserdata(idObj));
00269     delete sound;
00270 }
00271 
00272 void Lua_V2::PlayLoadedSound() {
00273     lua_Object idObj = lua_getparam(1);
00274     lua_Object loopingObj = lua_getparam(2);
00275     lua_Object volumeObj = lua_getparam(3);
00276     /* FIXME: unknown parameter */
00277     /*lua_Object bool2Obj =*/ lua_getparam(4);
00278 
00279     if (!lua_isuserdata(idObj) || lua_tag(idObj) != MKTAG('A', 'I', 'F', 'F')) {
00280         // can't use error since it actually may happen:
00281         // when entering the bait shop after the termites were already put on Mandrill's cane,
00282         // the LUA code will not load the termite sound files but the script which starts
00283         // the sounds is running anyway
00284         warning("Lua_V2::PlayLoadedSound - ERROR: Unknown parameters");
00285         return;
00286     }
00287 
00288     bool looping = !lua_isnil(loopingObj);
00289 
00290     PoolSound *sound = PoolSound::getPool().getObject(lua_getuserdata(idObj));
00291     if (!sound) {
00292         warning("Lua_V2::PlayLoadedSound: can't find requested sound object");
00293         return;
00294     }
00295 
00296     int volume = MAX_EMI_VOLUME;
00297     if (!lua_isnumber(volumeObj)) {
00298         // In the demo when the dart hits the balloon in the scumm bar, nil is passed
00299         // to the volume parameter.
00300         warning("Lua_V2::PlayLoadedSound - Unexpected parameter found, using default volume");
00301     } else {
00302         volume = (int)lua_getnumber(volumeObj);
00303     }
00304     sound->setVolume(convertEmiVolumeToMixer(volume));
00305     sound->play(looping);
00306 }
00307 
00308 void Lua_V2::PlayLoadedSoundFrom() {
00309     lua_Object idObj = lua_getparam(1);
00310     lua_Object xObj = lua_getparam(2);
00311     lua_Object yObj = lua_getparam(3);
00312     lua_Object zObj = lua_getparam(4);
00313     lua_Object volumeOrLoopingObj = lua_getparam(5);
00314     lua_Object volumeObj = lua_getparam(6);
00315 
00316     if (!lua_isuserdata(idObj) || lua_tag(idObj) != MKTAG('A', 'I', 'F', 'F')) {
00317         warning("Lua_V2::PlayLoadedSoundFrom - ERROR: Unknown parameters");
00318         return;
00319     }
00320 
00321     if (!lua_isnumber(xObj) || !lua_isnumber(yObj) || !lua_isnumber(zObj) ||
00322         !lua_isnumber(volumeObj)) {
00323         error("Lua_V2::PlayLoadedSoundFrom - ERROR: Unknown parameters");
00324         return;
00325     }
00326 
00327     float x = lua_getnumber(xObj);
00328     float y = lua_getnumber(yObj);
00329     float z = lua_getnumber(zObj);
00330 
00331     int volume = MAX_EMI_VOLUME;
00332     bool looping = false;
00333 
00334     if (lua_isnumber(volumeOrLoopingObj)) {
00335         volume = (int)lua_getnumber(volumeOrLoopingObj);
00336         /* special handling if 5th parameter is a boolean */
00337         if (volume <= 1) {
00338             looping = volume;
00339             volume = (int)lua_getnumber(volumeObj);
00340         }
00341     } else {
00342         volume = (int)lua_getnumber(volumeObj);
00343         looping = !lua_isnil(volumeOrLoopingObj);
00344     }
00345 
00346     PoolSound *sound = PoolSound::getPool().getObject(lua_getuserdata(idObj));
00347     if (!sound) {
00348         warning("Lua_V2::PlayLoadedSoundFrom: can't find requested sound object");
00349         return;
00350     }
00351     Math::Vector3d pos(x, y, z);
00352     sound->setVolume(convertEmiVolumeToMixer(volume));
00353     sound->playFrom(pos, looping);
00354 }
00355 
00356 void Lua_V2::StopSound() {
00357     lua_Object idObj = lua_getparam(1);
00358 
00359     if (!lua_isuserdata(idObj) || lua_tag(idObj) != MKTAG('A', 'I', 'F', 'F')) {
00360         warning("Lua_V2::StopSound - ERROR: Unknown parameters");
00361         return;
00362     }
00363 
00364     PoolSound *sound = PoolSound::getPool().getObject(lua_getuserdata(idObj));
00365     if (!sound) {
00366         warning("Lua_V2::StopSound: can't find requested sound object");
00367         return;
00368     }
00369     sound->stop();
00370 }
00371 
00372 void Lua_V2::IsSoundPlaying() {
00373     lua_Object idObj = lua_getparam(1);
00374 
00375     if (!lua_isuserdata(idObj) || lua_tag(idObj) != MKTAG('A', 'I', 'F', 'F')) {
00376         // can't use error since it actually may happen during normal operation
00377         warning("Lua_V2::IsSoundPlaying - ERROR: Unknown parameters");
00378         pushbool(false);
00379         return;
00380     }
00381 
00382     PoolSound *sound = PoolSound::getPool().getObject(lua_getuserdata(idObj));
00383     if (sound) {
00384         if (sound->isPlaying()) {
00385             pushbool(true);
00386             return;
00387         }
00388     } else {
00389         warning("Lua_V2::IsSoundPlaying: no sound track associated");
00390     }
00391     pushbool(false);
00392 }
00393 
00394 void Lua_V2::PlaySound() {
00395     lua_Object strObj = lua_getparam(1);
00396     lua_Object volumeObj = lua_getparam(2);
00397 
00398     if (!lua_isstring(strObj)) {
00399         error("Lua_V2::PlaySound - ERROR: Unknown parameters");
00400         return;
00401     }
00402     const char *str = lua_getstring(strObj);
00403 
00404     int volume = MAX_EMI_VOLUME;
00405     if (!lua_isnumber(volumeObj)) {
00406         warning("Lua_V2::PlaySound - Unexpected parameter(s) found, using default volume for %s", str);
00407     } else {
00408         volume = (int)lua_getnumber(volumeObj);
00409     }
00410 
00411     Common::String filename = addSoundSuffix(str);
00412 
00413     if (!g_emiSound->startSfx(filename, convertEmiVolumeToMixer(volume))) {
00414         Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::PlaySound: Could not open sound '%s'", filename.c_str());
00415     }
00416 }
00417 
00418 void Lua_V2::PlaySoundFrom() {
00419     lua_Object strObj = lua_getparam(1);
00420     lua_Object xObj = lua_getparam(2);
00421     lua_Object yObj = lua_getparam(3);
00422     lua_Object zObj = lua_getparam(4);
00423     /* FIXME: unknown parameter */
00424     lua_Object volumeOrUnknownObj = lua_getparam(5);
00425     lua_Object volumeObj = lua_getparam(6);
00426 
00427     int volume = MAX_EMI_VOLUME;
00428 
00429     if (!lua_isstring(strObj)) {
00430         error("Lua_V2::PlaySoundFrom - ERROR: Unknown parameters");
00431         return;
00432     }
00433 
00434     if (!lua_isnumber(xObj) || !lua_isnumber(yObj) || !lua_isnumber(zObj)) {
00435         error("Lua_V2::PlayLoadedSoundFrom - ERROR: Unknown parameters");
00436         return;
00437     }
00438     float x = lua_getnumber(xObj);
00439     float y = lua_getnumber(yObj);
00440     float z = lua_getnumber(zObj);
00441 
00442     // arg5 is optional and if present, it is FALSE
00443     if (lua_isnumber(volumeObj)) {
00444         volume = (int)lua_getnumber(volumeObj);
00445     } else if (lua_isnumber(volumeOrUnknownObj)) {
00446         volume = (int)lua_getnumber(volumeOrUnknownObj);
00447     } else {
00448         error("Lua_V2::PlaySoundFrom - ERROR: Unknown parameters");
00449         return;
00450     }
00451 
00452     const char *str = lua_getstring(strObj);
00453     Common::String filename = addSoundSuffix(str);
00454 
00455     Math::Vector3d pos(x, y, z);
00456 
00457     if (!g_emiSound->startSfxFrom(filename.c_str(), pos, convertEmiVolumeToMixer(volume))) {
00458         Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::PlaySoundFrom: Could not open sound '%s'", filename.c_str());
00459     }
00460 }
00461 
00462 void Lua_V2::GetSoundVolume() {
00463     lua_Object idObj = lua_getparam(1);
00464     if (!lua_isuserdata(idObj) || lua_tag(idObj) != MKTAG('A', 'I', 'F', 'F')) {
00465         error("Lua_V2::GetSoundVolume: Unknown Parameters");
00466         return;
00467     }
00468     PoolSound *sound = PoolSound::getPool().getObject(lua_getuserdata(idObj));
00469     if (sound) {
00470         lua_pushnumber(convertMixerVolumeToEmi(sound->getVolume()));
00471     } else {
00472         warning("Lua_V2::GetSoundVolume: can't find sound track");
00473         lua_pushnumber(convertMixerVolumeToEmi(Audio::Mixer::kMaxChannelVolume));
00474     }
00475 }
00476 
00477 void Lua_V2::SetSoundVolume() {
00478     lua_Object idObj = lua_getparam(1);
00479     lua_Object volumeObj = lua_getparam(2);
00480     if (!lua_isuserdata(idObj) || lua_tag(idObj) != MKTAG('A', 'I', 'F', 'F')) {
00481         error("Lua_V2::SetSoundVolume: no valid sound id");
00482         return;
00483     }
00484     if (!lua_isnumber(volumeObj)) {
00485         error("Lua_V2::SetSoundVolume - ERROR: Unknown parameters");
00486         return;
00487     }
00488 
00489     int volume = (int)lua_getnumber(volumeObj);
00490     PoolSound *sound = PoolSound::getPool().getObject(lua_getuserdata(idObj));
00491 
00492     if (sound) {
00493         sound->setVolume(convertEmiVolumeToMixer(volume));
00494     } else {
00495         warning("Lua_V2:SetSoundVolume: can't find sound track");
00496     }
00497 }
00498 
00499 void Lua_V2::UpdateSoundPosition() {
00500     lua_Object idObj = lua_getparam(1);
00501     lua_Object param2 = lua_getparam(2);
00502     lua_Object param3 = lua_getparam(3);
00503     lua_Object param4 = lua_getparam(4);
00504 
00505     if (!lua_isuserdata(idObj) || lua_tag(idObj) != MKTAG('A', 'I', 'F', 'F'))
00506         return;
00507 
00508     if (!lua_isnumber(param2) || !lua_isnumber(param3) || !lua_isnumber(param4))
00509         return;
00510     
00511     float x = lua_getnumber(param2);
00512     float y = lua_getnumber(param3);
00513     float z = lua_getnumber(param4);
00514     PoolSound *sound = PoolSound::getPool().getObject(lua_getuserdata(idObj));
00515     if (!sound)
00516         return;
00517     Math::Vector3d pos(x, y, z);
00518     sound->setPosition(pos);
00519 }
00520 
00521 void Lua_V2::ImSetMusicVol() {
00522     // This only seems to be used in the demo.
00523     lua_Object volumeObj = lua_getparam(1);
00524 
00525     if (!lua_isnumber(volumeObj))
00526         return;
00527     int volume = (int)lua_getnumber(volumeObj);
00528     Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSetMusicVol: implement opcode, wants volume %d", convertEmiVolumeToMixer(volume));
00529 }
00530 
00531 void Lua_V2::ImSetSfxVol() {
00532     // This only seems to be used in the demo.
00533     lua_Object volumeObj = lua_getparam(1);
00534 
00535     if (!lua_isnumber(volumeObj))
00536         return;
00537     int volume = (int)lua_getnumber(volumeObj);
00538     Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSetSfxVol: implement opcode, wants volume %d", convertEmiVolumeToMixer(volume));
00539 }
00540 
00541 void Lua_V2::ImSetVoiceVol() {
00542     // This only seems to be used in the demo.
00543     lua_Object volumeObj = lua_getparam(1);
00544 
00545     if (!lua_isnumber(volumeObj))
00546         return;
00547     int volume = (int)lua_getnumber(volumeObj);
00548     Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSetVoiceVol: implement opcode, wants volume %d", convertEmiVolumeToMixer(volume));
00549 }
00550 
00551 void Lua_V2::ImSetVoiceEffect() {
00552     // This only seems to be used in the demo.
00553     lua_Object strObj = lua_getparam(1);
00554 
00555     if (!lua_isstring(strObj))
00556         return;
00557 
00558     const char *str = lua_getstring(strObj);
00559     Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSetVoiceEffect: implement opcode, wants effect %s", str);
00560 }
00561 
00562 void Lua_V2::StopAllSounds() {
00563     Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::StopAllSounds: implement opcode");
00564 }
00565 
00566 void Lua_V2::ImPushState() {
00567     lua_Object stateObj = lua_getparam(1);
00568     //lua_Object unknownBoolObj = lua_getparam(2);
00569 
00570     g_emiSound->pushStateToStack();
00571 
00572     if (lua_isnumber(stateObj)) {
00573         int state = (int)lua_getnumber(stateObj);
00574         g_imuseState = state;
00575     }
00576 
00577     Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImPushState: currently guesswork");
00578 }
00579 void Lua_V2::ImPopState() {
00580     g_emiSound->popStateFromStack();
00581     Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImPopState: currently guesswork");
00582 }
00583 
00584 // Used in the demo only.
00585 void Lua_V2::ImPause() {
00586     g_emiSound->pause(true);
00587 }
00588 
00589 // Used in the demo only.
00590 void Lua_V2::ImResume() {
00591     g_emiSound->pause(false);
00592 }
00593 
00594 } // end of namespace Grim


Generated on Sat Nov 30 2019 05:00:26 for ResidualVM by doxygen 1.7.1
curved edge   curved edge