本文整理汇总了C++中SoundChannel::setPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ SoundChannel::setPosition方法的具体用法?C++ SoundChannel::setPosition怎么用?C++ SoundChannel::setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoundChannel
的用法示例。
在下文中一共展示了SoundChannel::setPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _update
/**
* @author JoSch
* @date 03-11-2005
*/
void SoundObject::_update()
{
ActorControlledObject::_update();
SoundChannel *channel = getSoundChannel();
Actor *actor = getActor();
if (!channel || !actor) // Einer ist Null
{
return;
}
if (!channel->isValid())
{
return;
}
channel->setPosition(actor->getPosition());
Vector3 *temp1 = new Vector3();
Vector3 *temp2 = new Vector3(actor->getPosition());
Real length = temp2->normalise();
actor->getOrientation().ToAxes(temp1);
*temp1 += *temp2;
*temp1 *= length;
channel->setDirection(*temp1);
}
示例2: pos
void test_playWith3D()
{
xtime xt;
Ogre::ResourceManager::ResourceMapIterator it =
SoundManager::getSingleton().getResourceIterator();
while (it.hasMoreElements())
{
SoundResourcePtr soundres = it.getNext();
SoundStream *sound = new SoundStream(soundres);
SoundChannel *channel = new SoundChannel(sound, soundres->getName());
if (channel)
{
channel->play();
float angle = 0.0f;
xtime_get(&xt, TIME_UTC);
xt.sec++;
thread::sleep(xt);
while (channel->isPlaying()) {
xtime_get(&xt, TIME_UTC);
xt.nsec+=100000;
thread::sleep(xt);
Vector3 pos(1.0f*sinf(angle), 20.0f*cosf(angle), 0.0f);
channel->setPosition(pos);
angle += 0.005;
if (angle > 2 * M_PI)
{
angle = 0.0f;
}
FSOUND_Update();
}
delete channel;
}
}
}