当前位置: 首页>>代码示例>>C++>>正文


C++ Mod::getSound方法代码示例

本文整理汇总了C++中Mod::getSound方法的典型用法代码示例。如果您正苦于以下问题:C++ Mod::getSound方法的具体用法?C++ Mod::getSound怎么用?C++ Mod::getSound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mod的用法示例。


在下文中一共展示了Mod::getSound方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: operator

	void operator()()
	{
		while (_flcPlayer->getFrameCount() >= introSoundTrack[trackPosition].frameNumber)
		{
			int command = introSoundTrack[trackPosition].sound;

			if (command & 0x200)
			{
#ifndef __NO_MUSIC
				switch(command)
				{
				case 0x200:
					Log(LOG_DEBUG) << "Playing gmintro1";
					m = mod->getMusic("GMINTRO1");
					m->play(1);
					break;
				case 0x201:
					Log(LOG_DEBUG) << "Playing gmintro2";
					m = mod->getMusic("GMINTRO2");
					m->play(1);
					break;
				case 0x202:
					Log(LOG_DEBUG) << "Playing gmintro3";
					m = mod->getMusic("GMINTRO3");
					m->play(1);
					//Mix_HookMusicFinished(_FlcPlayer::stop);
					break;
				}
#endif
			}
			else if (command & 0x400)
			{
				int newSpeed = (command & 0xff);
				_flcPlayer->setHeaderSpeed(newSpeed);
				Log(LOG_DEBUG) << "Frame delay now: " << newSpeed;
			}
			else if (command <= 0x19)
			{
				for (soundInFile **sounds = introSounds; *sounds; ++sounds) // try hybrid sound set, then intro.cat or sample3.cat alone
				{
					soundInFile *sf = (*sounds) + command;
					int channel = trackPosition % 4; // use at most four channels to play sound effects
					double ratio = (double)Options::soundVolume / MIX_MAX_VOLUME;
					Log(LOG_DEBUG) << "playing: " << sf->catFile << ":" << sf->sound << " for index " << command;
					s = mod->getSound(sf->catFile, sf->sound, false);
					if (s)
					{
						s->play(channel);
						Mix_Volume(channel, sf->volume * ratio);
						break;
					}
					else Log(LOG_DEBUG) << "Couldn't play " << sf->catFile << ":" << sf->sound;
				}
			}
			++trackPosition;
		}

	}
开发者ID:R1dO,项目名称:OpenXcom,代码行数:58,代码来源:VideoState.cpp


注:本文中的Mod::getSound方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。