void Scripts::cmdLoadSound() { int idx = _data->readSint16LE(); _vm->_sound->_soundTable.clear(); Resource *sound = _vm->_files->loadFile(_vm->_extraCells[idx]._vidSound); _vm->_sound->_soundTable.push_back(SoundEntry(sound, 1)); }
int QMixer::qsWaveMixPlayEx(int iChannel, uint flags, CWaveFile *waveFile, int loops, const QMIXPLAYPARAMS ¶ms) { if (iChannel == -1) { // Find a free channel for (iChannel = 0; iChannel < (int)_channels.size(); ++iChannel) { if (_channels[iChannel]._sounds.empty()) break; } assert(iChannel != (int)_channels.size()); } // If the new sound replaces current ones, then clear the channel ChannelEntry &channel = _channels[iChannel]; if (flags & QMIX_CLEARQUEUE) { if (!channel._sounds.empty() && channel._sounds.front()._started) _mixer->stopHandle(channel._sounds.front()._soundHandle); channel._sounds.clear(); } // Add the sound to the channel channel._sounds.push_back(SoundEntry(waveFile, params.callback, loops, params.dwUser)); qsWaveMixPump(); return 0; }
void SoundManager::Load(string Name, string Path, FMOD_MODE Flags) { if(Exists(Name)) { DebugScreen::GetInstance()->AddLogMessage("Sound: \"" + Name + "\" is already loaded.", Red); return; } FMOD::Sound* tSound; gResult = gSystem->createSound(Path.c_str(), Flags, 0, &tSound); ErrorCheck(gResult); gLoadedSounds[gLoadedSounds.size()] = SoundEntry(Name, tSound); }