以 3D 方式播放 fmod 事件声音

发布于 2024-11-18 14:04:41 字数 763 浏览 5 评论 0原文

我有一个名为 Numbers 的活动。在 Fmod Designer 中,事件根据监听器角度播放不同的数字。当我将此事件放置在 3D 空间中时,我希望能够听到不同的声音。这是我目前拥有的代码。它只播放我的应用程序中的数字之一。我错过了什么吗?

FMOD_RESULT         result     = FMOD_OK;
    FMOD_VECTOR         listenerpos;
    FMOD_VECTOR         forward         = { 0.0f, 0.0f, 1.0f };
    FMOD_VECTOR         up              = { 0.0f, 1.0f, 0.0f };
    FMOD_VECTOR         vel             = { 0.0f, 0.0f, 0.0f };

    result = group->getEvent("Numbers", FMOD_EVENT_DEFAULT, &event);
        ERRCHECK(result);

    listenerpos.x = 0.436243;
    listenerpos.y = -0.43643;
    listenerpos.z = -6;

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

非常感谢帮助!谢谢!

I have an event called Numbers. In Fmod Designer the event plays different numbers depending on listenerAngle. I want to be able to hear the different sounds when I position this event in a 3D space. This is the code I have at the moment. It only plays one of the numbers in my app. Am I missing something?

FMOD_RESULT         result     = FMOD_OK;
    FMOD_VECTOR         listenerpos;
    FMOD_VECTOR         forward         = { 0.0f, 0.0f, 1.0f };
    FMOD_VECTOR         up              = { 0.0f, 1.0f, 0.0f };
    FMOD_VECTOR         vel             = { 0.0f, 0.0f, 0.0f };

    result = group->getEvent("Numbers", FMOD_EVENT_DEFAULT, &event);
        ERRCHECK(result);

    listenerpos.x = 0.436243;
    listenerpos.y = -0.43643;
    listenerpos.z = -6;

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

Help is very much appreciated! Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我恋#小黄人 2024-11-25 14:04:41

也许您的“数字”事件是 2D 的?你能检查并确保它是 3D 的吗?

Perhaps your "Numbers" event is 2D? Can you check and ensure it's 3D.

幽蝶幻影 2024-11-25 14:04:41

我添加了一些行并使其正常工作。我必须将事件放置在 3D 世界中。

FMOD_RESULT    result = FMOD_OK;
FMOD_VECTOR    listenerpos = { 0.0f, 0.0f, 1.0f };
FMOD_VECTOR    eventpos        = { 0.0f, 0.0f, 1.0f };
float DISTANCEFACTOR          = 2.0f;

result = group->getEvent("Numbers", FMOD_EVENT_DEFAULT, &event);
ERRCHECK(result);

listenerpos.x = 0;
listenerpos.y = 0;
listenerpos.z = 0;    

result = eventSystem->set3DListenerAttributes(0, &listenerpos,NULL,NULL,NULL);
ERRCHECK(result);

eventpos.x = xPos; // Object's x position on iPhone I move around
eventpos.z = yPos;


result = event->set3DAttributes(&eventpos2,&vel);
ERRCHECK(result);

result = eventSystem->update();
ERRCHECK(result);

result = ballEvent->start();
ERRCHECK(result);

I added some lines and got it working. I had to place out the event in the 3D world.

FMOD_RESULT    result = FMOD_OK;
FMOD_VECTOR    listenerpos = { 0.0f, 0.0f, 1.0f };
FMOD_VECTOR    eventpos        = { 0.0f, 0.0f, 1.0f };
float DISTANCEFACTOR          = 2.0f;

result = group->getEvent("Numbers", FMOD_EVENT_DEFAULT, &event);
ERRCHECK(result);

listenerpos.x = 0;
listenerpos.y = 0;
listenerpos.z = 0;    

result = eventSystem->set3DListenerAttributes(0, &listenerpos,NULL,NULL,NULL);
ERRCHECK(result);

eventpos.x = xPos; // Object's x position on iPhone I move around
eventpos.z = yPos;


result = event->set3DAttributes(&eventpos2,&vel);
ERRCHECK(result);

result = eventSystem->update();
ERRCHECK(result);

result = ballEvent->start();
ERRCHECK(result);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文