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


C++ System::set3DListenerAttributes方法代码示例

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


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

示例1: setVelocity

	void FMODAudioListener::setVelocity(const Vector3& velocity)
	{
		AudioListener::setVelocity(velocity);

		FMOD::System* fmod = gFMODAudio()._getFMOD();
		FMOD_VECTOR value = { velocity.x, velocity.y, velocity.z };

		fmod->set3DListenerAttributes(mId, nullptr, &value, nullptr, nullptr);
	}
开发者ID:AlfHub,项目名称:BansheeEngine,代码行数:9,代码来源:BsFMODAudioListener.cpp

示例2: setUp

	void FMODAudioListener::setUp(const Vector3& up)
	{
		AudioListener::setUp(up);

		FMOD::System* fmod = gFMODAudio()._getFMOD();
		FMOD_VECTOR value = { up.x, up.y, up.z };

		fmod->set3DListenerAttributes(mId, nullptr, nullptr, nullptr, &value);
	}
开发者ID:AlfHub,项目名称:BansheeEngine,代码行数:9,代码来源:BsFMODAudioListener.cpp

示例3: setDirection

	void FMODAudioListener::setDirection(const Vector3& direction)
	{
		AudioListener::setDirection(direction);

		FMOD::System* fmod = gFMODAudio()._getFMOD();
		FMOD_VECTOR value = { direction.x, direction.y, direction.z };

		fmod->set3DListenerAttributes(mId, nullptr, nullptr, &value, nullptr);
	}
开发者ID:AlfHub,项目名称:BansheeEngine,代码行数:9,代码来源:BsFMODAudioListener.cpp

示例4: setPosition

	void FMODAudioListener::setPosition(const Vector3& position)
	{
		AudioListener::setPosition(position);

		FMOD::System* fmod = gFMODAudio()._getFMOD();
		FMOD_VECTOR value = { position.x, position.y, position.z };

		fmod->set3DListenerAttributes(mId, &value, nullptr, nullptr, nullptr);
	}
开发者ID:AlfHub,项目名称:BansheeEngine,代码行数:9,代码来源:BsFMODAudioListener.cpp

示例5: Update

	void FMOD_System::Update( const float& posX, const float& posY, const float& posZ, 
		const float& forwardX, const float& forwardY, const float& forwardZ, 
		const float& ballPosX, const float& ballPosY, const float& ballPosZ )
	{
		FMOD_VECTOR position = { posX, posY, posZ };
		FMOD_VECTOR forward = { forwardX, forwardY, forwardZ };
		system->set3DListenerAttributes( 0, &position, nullptr, &forward, nullptr );
		ballPosition.x = ballPosX;
		ballPosition.y = ballPosY;
		ballPosition.z = ballPosZ;
		system->update();
	}
开发者ID:gemini14,项目名称:AirBall,代码行数:12,代码来源:SoundSystem.cpp

示例6: rebuild

	void FMODAudioListener::rebuild(INT32 id)
	{
		mId = id;

		FMOD::System* fmod = gFMODAudio()._getFMOD();
		FMOD_VECTOR position = { mPosition.x, mPosition.y, mPosition.z };
		FMOD_VECTOR velocity = { mVelocity.x, mVelocity.y, mVelocity.z };
		FMOD_VECTOR forward = { mDirection.x, mDirection.y, mDirection.z };
		FMOD_VECTOR up = { mUp.x, mUp.y, mUp.z };

		fmod->set3DListenerAttributes(mId, &position, &velocity, &forward, &up);
	}
开发者ID:AlfHub,项目名称:BansheeEngine,代码行数:12,代码来源:BsFMODAudioListener.cpp

示例7:

void FmodExMultiple3DSoundPlayerApp::update()
{
	
	
	//Update camera
	Vec3f camDirection = camCenter;
	camDirection.normalize();
	camEye = camInitialEye + camDistance * camDirection;
	cam.setViewDirection(camCenter);
	cam.setEyePoint(camEye);
	gl::setMatrices( cam );
	gl::rotate( sceneRotation );
	
	//Update 3D Sounds
	
	Vec3f up = cam.getWorldUp();
	up.invert();
	
	listenerUp.x = up.x;
	listenerUp.y = up.y; 
	listenerUp.z = up.z;
	listenerPos.x = camEye.x; 
	listenerPos.y = camEye.y;  
	listenerPos.z = camEye.z;
	//forward = camCenter - camEye;
	//forward.normalize();
	listenerForward.x = camCenter.x; 
	listenerForward.y = camCenter.y; 
	listenerForward.z = camCenter.z;
	sys->set3DListenerAttributes( 0, &listenerPos, &listenerVelocity, &listenerForward, &listenerUp);
	
	if(!player1.getIsPlaying())
		player1.play();
	
	if(!player2.getIsPlaying())
		player2.play();	
	
	player1.channel->set3DAttributes( &sound3DPosition1, &sound3DVelocity1);
	player2.channel->set3DAttributes( &sound3DPosition2, &sound3DVelocity2);
	
	//we update the fmod sound system
	sys->update();
	//FmodexUpdate();
	
}
开发者ID:bgbotond,项目名称:Cinder-FMOD,代码行数:45,代码来源:FmodExMultiple3DSoundPlayerApp.cpp

示例8: main


//.........这里部分代码省略.........
                channel2->setPaused(!paused);
            }

            if (key == '3') 
            {
                result = system->playSound(FMOD_CHANNEL_FREE, sound3, false, &channel3);
                ERRCHECK(result);
            }

            if (key == ' ')
            {
                listenerflag = !listenerflag;
            }

            if (!listenerflag)
            {
                if (key == '<') 
                {
                    listenerpos.x -= 1.0f * DISTANCEFACTOR;
                    if (listenerpos.x < -35 * DISTANCEFACTOR)
                    {
                        listenerpos.x = -35 * DISTANCEFACTOR;
                    }
                }
                if (key == '>') 
                {
                    listenerpos.x += 1.0f * DISTANCEFACTOR;
                    if (listenerpos.x > 36 * DISTANCEFACTOR)
                    {
                        listenerpos.x = 36 * DISTANCEFACTOR;
                    }
                }
            }
        }

        // ==========================================================================================
        // UPDATE THE LISTENER
        // ==========================================================================================
        {
            static float t = 0;
            static FMOD_VECTOR lastpos = { 0.0f, 0.0f, 0.0f };
            FMOD_VECTOR forward        = { 0.0f, 0.0f, 1.0f };
            FMOD_VECTOR up             = { 0.0f, 1.0f, 0.0f };
            FMOD_VECTOR vel;

            if (listenerflag)
            {
                listenerpos.x = (float)sin(t * 0.05f) * 33.0f * DISTANCEFACTOR; // left right pingpong
            }

            // ********* NOTE ******* READ NEXT COMMENT!!!!!
            // vel = how far we moved last FRAME (m/f), then time compensate it to SECONDS (m/s).
            vel.x = (listenerpos.x - lastpos.x) * (1000 / INTERFACE_UPDATETIME);
            vel.y = (listenerpos.y - lastpos.y) * (1000 / INTERFACE_UPDATETIME);
            vel.z = (listenerpos.z - lastpos.z) * (1000 / INTERFACE_UPDATETIME);

            // store pos for next time
            lastpos = listenerpos;

            result = system->set3DListenerAttributes(0, &listenerpos, &vel, &forward, &up);
            ERRCHECK(result);

            t += (30 * (1.0f / (float)INTERFACE_UPDATETIME));    // t is just a time value .. it increments in 30m/s steps in this example

            // print out a small visual display
            {
                char s[80];

                sprintf(s, "|.......................<1>......................<2>....................|");

                s[(int)(listenerpos.x / DISTANCEFACTOR) + 35] = 'L';
                printf("%s\r", s);
            }
        }

        system->update();

        Sleep(INTERFACE_UPDATETIME - 1);

    } while (key != 27);

    printf("\n");

    /*
        Shut down
    */
    result = sound1->release();
    ERRCHECK(result);
    result = sound2->release();
    ERRCHECK(result);
    result = sound3->release();
    ERRCHECK(result);

    result = system->close();
    ERRCHECK(result);
    result = system->release();
    ERRCHECK(result);

    return 0;
}
开发者ID:sethcoder,项目名称:SDK,代码行数:101,代码来源:main.cpp

示例9: main


//.........这里部分代码省略.........
                channel2->setPaused(!paused);
            }

            if (key == '3') 
            {
                result = system->playSound(FMOD_CHANNEL_FREE, sound3, false, &channel3);
                ERRCHECK(result);
            }

            if (key == ' ')
            {
                listenerflag = !listenerflag;
            }

            if (!listenerflag)
            {
                if (key == '<') 
                {
                    listenerpos.x -= 1.0f * DISTANCEFACTOR;
                    if (listenerpos.x < -35 * DISTANCEFACTOR)
                    {
                        listenerpos.x = -35 * DISTANCEFACTOR;
                    }
                }
                if (key == '>') 
                {
                    listenerpos.x += 1.0f * DISTANCEFACTOR;
                    if (listenerpos.x > 36 * DISTANCEFACTOR)
                    {
                        listenerpos.x = 36 * DISTANCEFACTOR;
                    }
                }
            }
        }

        // ==========================================================================================
        // UPDATE THE LISTENER
        // ==========================================================================================
        {
            static float t = 0;
            static FMOD_VECTOR lastpos = { 0.0f, 0.0f, 0.0f };
            FMOD_VECTOR forward        = { 0.0f, 0.0f, 1.0f };
            FMOD_VECTOR up             = { 0.0f, 1.0f, 0.0f };
            FMOD_VECTOR vel;

            if (listenerflag)
            {
                listenerpos.x = (float)sin(t * 0.05f) * 33.0f * DISTANCEFACTOR; // left right pingpong
            }

            // ********* NOTE ******* READ NEXT COMMENT!!!!!
            // vel = how far we moved last FRAME (m/f), then time compensate it to SECONDS (m/s).
            vel.x = (listenerpos.x - lastpos.x) * (1000 / INTERFACE_UPDATETIME);
            vel.y = (listenerpos.y - lastpos.y) * (1000 / INTERFACE_UPDATETIME);
            vel.z = (listenerpos.z - lastpos.z) * (1000 / INTERFACE_UPDATETIME);

            // store pos for next time
            lastpos = listenerpos;

            result = system->set3DListenerAttributes(0, &listenerpos, &vel, &forward, &up);
            ERRCHECK(result);

            t += (30 * (1.0f / (float)INTERFACE_UPDATETIME));    // t is just a time value .. it increments in 30m/s steps in this example

            // print out a small visual display
            {
                char s[80];

                sprintf(s, "|.......................<1>......................<2>....................|");

                s[(int)(listenerpos.x / DISTANCEFACTOR) + 35] = 'L';
                printf("%s\r", s);
            }
        }

        system->update();

        Sleep(INTERFACE_UPDATETIME - 1);

    } while (key != 27);

    printf("\n");

    /*
        Shut down
    */
    result = sound1->release();
    ERRCHECK(result);
    result = sound2->release();
    ERRCHECK(result);
    result = sound3->release();
    ERRCHECK(result);

    result = system->close();
    ERRCHECK(result);
    result = system->release();
    ERRCHECK(result);

    return 0;
}
开发者ID:akerspoket,项目名称:TAJMS-Agil-Breakout,代码行数:101,代码来源:main.cpp


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