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


C++ SoundInstance::setVolume方法代码示例

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


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

示例1: setVolume

    void SoundPlayer::setVolume(float v)
    {
        _volume = v;
        for (playingSounds::iterator i = _sounds.begin(); i != _sounds.end(); ++i)
        {
            SoundInstance* s = (*i).get();
            s->setVolume(v);
        }

    }
开发者ID:zmeyc,项目名称:oxygine-sound,代码行数:10,代码来源:SoundPlayer.cpp

示例2: initialize

	virtual void initialize()
	{
		env = getEngine()->getSoundEnvironment();
		env->setAssetDirectory("/Users/evldemo/sounds/");
		
		// All sound files should be in .wav format
		// For positional sounds, file should be mono.
		// Rest of important sound code is in handleEvent()
		sound = env->loadSoundFromFile("beep", "/menu_sounds/menu_select.wav");
		music = env->loadSoundFromFile("music", "/music/filmic.wav");
		sound1 = env->loadSoundFromFile("tricorder", "/arthur/TOS-tricorder.wav");

		// playStereo() is for ambient music.
		// Currently available functions:
		//	 setVolume(float) - amplitude from (0.0 - 1.0)
		//	 setLoop(bool)
		//	 stop() - this means this instance is finished and a new
		//			  sound instance will need to be created to play
		SoundInstance* musicInst = new SoundInstance(music);
		musicInst->setVolume(0.2f);
		musicInst->playStereo();

		changeCubeColor = false;
	}
开发者ID:drspiff,项目名称:omegalib,代码行数:24,代码来源:omegaSound.cpp

示例3: SoundManager

	SoundTest()
	{
		//soundManager = new SoundManager();
		//soundManager->connectToServer("localhost",57120);
		
		// More concise method of above two lines
		soundManager = new SoundManager("localhost",57120);

		soundManager->showDebugInfo(true);

		// Get default sound environment
		env = soundManager->getSoundEnvironment();

		
		while( !soundManager->isSoundServerRunning() )
		{
			soundManager->startSoundServer();
		}

		// Load sound assets
		//env->setAssetDirectory("menu_sounds");

		showMenuSound = env->loadSoundFromFile("showMenuSound","menu_sounds/menu_load.wav");
		hideMenuSound = env->loadSoundFromFile("hideMenuSound","menu_sounds/menu_closed.wav");
		scrollMenuSound = env->loadSoundFromFile("scrollMenuSound","menu_sounds/menu_scroll.wav");
		selectMenuSound = env->loadSoundFromFile("selectMenuSound","menu_sounds/menu_select.wav");
		soundLoop = env->loadSoundFromFile("mus","Omega4Relay.wav");

		SoundInstance* soundInstance = new SoundInstance(showMenuSound);
		soundInstance->setReverb( 1.0, 1.0 );
		soundInstance->setVolume(1.0);
		soundInstance->setPosition( Vector3f(0,1,0) );
		soundInstance->play();

		rewindingSoundInstance = new SoundInstance(showMenuSound);
	}
开发者ID:OKaluza,项目名称:omicron,代码行数:36,代码来源:soundtest.cpp

示例4: handleEvent

void HelloApplication::handleEvent(const Event& evt)
{
	if(evt.getServiceType() == Service::Wand)
	{
				
		xPos = evt.getPosition().x();
		yPos = evt.getPosition().y();
		zPos = evt.getPosition().z();
		
		if( soundLoopInst != NULL )
			soundLoopInst->setPosition( evt.getPosition() );
	
		if( evt.getType() == Event::Down )
		{
			if( evt.getFlags() == Event::Button3 ) // Wand cross button
			{
				// playStereo() is for ambient music.
				// Currently available functions:
				//	 setVolume(float) - amplitude from (0.0 - 1.0)
				//	 setLoop(bool)
				//	 stop() - this means this instance is finished and a new
				//			  sound instance will need to be created to play
				SoundInstance* musicInst = new SoundInstance(music);
				musicInst->setVolume(0.2f);
				musicInst->playStereo();
			}
			else if( evt.getFlags() == Event::Button5 ) // Wand L1
			{
				env->getSoundManager()->stopAllSounds();
			}
			else if( evt.getFlags() == Event::ButtonLeft ) // DPad
			{
				SoundInstance* soundInst = new SoundInstance(sound);
				soundInst->setPosition( evt.getPosition() );
				soundInst->play();
				changeCubeColor = true;
			}
			else if( evt.getFlags() == Event::ButtonRight ) // DPad
			{
				if( soundLoopInst != NULL || !soundLoopInst->isPlaying() )
				{
					// Positional sounds use play()
					// Currently available functions:
					//	 stop() - this means this instance is finished and a new
					//			  sound instance will need to be created to play
					//	 setPosition(Vector3f) 
					//	 setVolume(float) - amplitude from (0.0 - 1.0)
					//	 setLoop(bool)
					//	 setMix(float) - wetness of sound (0.0 - 1.0)
					//	 setReverb(float) - room size / reverb amount (0.0 - 1.0)
					//	 setWidth(int) - number of speakers to spread sound across (1-20)
					//			This will eventually be replaced with a sound radius
					soundLoopInst = new SoundInstance(sound1);
					soundLoopInst->setPosition( evt.getPosition() );
					soundLoopInst->setLoop(true);
					soundLoopInst->setVolume(0.2f);
					soundLoopInst->setWidth(3);
					soundLoopInst->play();
				}
				else if( soundLoopInst != NULL )
				{
					soundLoopInst->stop();
				}
				
				changeCubeColor = true;
			}
			else
			{
				SoundInstance* soundInst = new SoundInstance(sound);
				soundInst->setPosition( evt.getPosition() );
				soundInst->setRoomSize(1.0);
				soundInst->setWetness(1.0);
				//soundInst->setVolume(0.5);
				soundInst->play();
				changeCubeColor = true;
			}
			
			
		}
		else if( evt.getType() == Event::Up )
		{
			changeCubeColor = false;
		}
	}
}
开发者ID:drspiff,项目名称:omegalib,代码行数:85,代码来源:omegaSound.cpp


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