ZVISION: Modify cmdLoadSound to allow manual rate and isStereo

Usually those variables are parsed from the file name
This commit is contained in:
richiesams 2013-08-17 09:38:24 -05:00
parent 0a840fa664
commit 7d24f46e7e

View File

@ -83,19 +83,29 @@ bool Console::cmdLoadVideo(int argc, const char **argv) {
} }
bool Console::cmdLoadSound(int argc, const char **argv) { bool Console::cmdLoadSound(int argc, const char **argv) {
if (argc != 2) {
DebugPrintf("Use loadsound <fileName> to load a sound\n");
return true;
}
if (!Common::File::exists(argv[1])) { if (!Common::File::exists(argv[1])) {
DebugPrintf("File does not exist\n"); DebugPrintf("File does not exist\n");
return true; return true;
} }
Audio::AudioStream *soundStream = makeRawZorkStream(argv[1], _engine); if (argc == 2) {
Audio::SoundHandle handle; Audio::AudioStream *soundStream = makeRawZorkStream(argv[1], _engine);
_engine->_mixer->playStream(Audio::Mixer::kPlainSoundType, &handle, soundStream, -1, 100, 0, DisposeAfterUse::YES, false, false); Audio::SoundHandle handle;
_engine->_mixer->playStream(Audio::Mixer::kPlainSoundType, &handle, soundStream, -1, 100, 0, DisposeAfterUse::YES, false, false);
} else if (argc == 4) {
int isStereo = atoi(argv[3]);
Common::File *file = new Common::File();
file->open(argv[1]);
Audio::AudioStream *soundStream = makeRawZorkStream(file, atoi(argv[2]), isStereo == 0 ? false : true);
Audio::SoundHandle handle;
_engine->_mixer->playStream(Audio::Mixer::kPlainSoundType, &handle, soundStream, -1, 100, 0, DisposeAfterUse::YES, false, false);
} else {
DebugPrintf("Use loadsound <fileName> [<rate> <isStereo: 1 or 0>] to load a sound\n");
return true;
}
return true; return true;
} }