0
0

hi!
i tried to use you exciting geometry feature but i am stuck :(

i post here my code with hope you can point me on my errors.

this creates cube at left of the listener and puts a sound source into it:

[code:1ffc3dic]

pragma hdrstop

include "fmod.h"

include "fmod_errors.h"

include <stdio.h>

include <conio.h>

pragma argsused

void errcheck(FMOD_RESULT r) {
printf("%s", FMOD_ErrorString(r));
}
int main(int argc, char* argv[])
{
FMOD_SOUND* s;
FMOD_GEOMETRY* g;
FMOD_CHANNEL* c;
FMOD_VECTOR v1={-5, 0, 0};
FMOD_VECTOR v2={0,0,0};
FMOD_VECTOR v3;
FMOD_SYSTEM* fs;
int pi;
FMOD_VECTOR pa1[4]={
{-1, -25, -25},
{-1, -25, 25},
{-1, 25, -25},
{-1, 25, 25}};
FMOD_VECTOR pa2[4]={
{-11, -25, -25},
{-11, -25, 25},
{-11, 25, -25},
{-11, 25, 25}};
FMOD_VECTOR pa3[4]={
{-1, -25, -25},
{-11, -25, -25},
{-1, 25, -25},
{-11, 25, -25}};
FMOD_VECTOR pa4[4]={
{-1, -25, 25},
{-11, -25, 25},
{-1, 25, 25},
{-11, 25, 25}};
FMOD_VECTOR pa5[4]={
{-1, -25, -25},
{-11, -25, -25},
{-1, -25, 25},
{-11, -25, 25}};
FMOD_VECTOR pa6[4]={
{-1, 25, -25},
{-11, 25, -25},
{-1, 25, 25},
{-11, 25, 25}};
errcheck(FMOD_System_Create(&fs));
errcheck(FMOD_System_Init(fs, 100, FMOD_INIT_NORMAL |FMOD_INIT_SOFTWARE_OCCLUSION | FMOD_INIT_SOFTWARE_HRTF, 0));
errcheck(FMOD_System_CreateSound(fs, "e:\music\маврин сергей\здесь и сейчас.mp3", FMOD_3D | FMOD_SOFTWARE, 0, &s));
errcheck(FMOD_System_PlaySound(fs, FMOD_CHANNEL_FREE, s, 1, &c));
errcheck(FMOD_Channel_Set3DAttributes (c, &v1,&v2));
errcheck(FMOD_Channel_SetPaused(c, 0));
v1.x=0;
v1.y=0;
v1.z=1;
v3.x=0;
v3.y=1;
v3.z=0;
errcheck(FMOD_System_Set3DListenerAttributes(fs, 0, &v2, &v2, &v1, &v3));
getch();
errcheck(FMOD_System_SetGeometrySettings(fs, 200));
errcheck(FMOD_System_CreateGeometry(fs, 6,24, &g));
errcheck(FMOD_Geometry_AddPolygon(g, 1, 1, 1, 4, pa1, &pi));
errcheck(FMOD_Geometry_AddPolygon(g, 1, 1, 1, 4, pa2, &pi));
errcheck(FMOD_Geometry_AddPolygon(g, 1, 1, 1, 4, pa3, &pi));
errcheck(FMOD_Geometry_AddPolygon(g, 1, 1, 1, 4, pa4, &pi));
errcheck(FMOD_Geometry_AddPolygon(g, 1, 1, 1, 4, pa5, &pi));
errcheck(FMOD_Geometry_AddPolygon(g, 1, 1, 1, 4, pa6, &pi));
errcheck(FMOD_Geometry_SetActive(g, 1));
errcheck(FMOD_System_Update(fs));
getch();
FMOD_Sound_Release(s);
FMOD_System_Release(fs);
return 0;
}
[/code:1ffc3dic]

  • You must to post comments
0
0

There are 2 main problems with your code.

1 The most important one. Your quads are twisted.

They look like this

[code:2p2ihey6]

\ /
\ /
\ /
/ \
/ \

/ \

[/code:2p2ihey6]

your first poly (the only one occluding in this example should look like this)

[code:2p2ihey6]
FMOD_VECTOR pa1[4]={
{-1, -25, -25},
{-1, -25, 25},
{-1, 25, 25},
{-1, 25, -25}};
[/code:2p2ihey6]

I can see just by glancing at the others 2 and 3 look twisted as well. There should be two numbers in each row that match the values above it (only change one axist at a time), so that it doesnt twist.

2 You’re not letting the system update fade out the occlusion, you’re just using getch().

In the second getch, you should have something like this (like a normal game loop for example)

[code:2p2ihey6]
do
{
errcheck(FMOD_System_Update(fs));
Sleep(50);
} while (!kbhit());
getch();
[/code:2p2ihey6]

FMOD -does- detect if you dont fade between updates and so fades out immediately, but you didnt get a system update after the FMOD_System_Set3DListenerAttributes call so it couldn’t do that.

  • You must to post comments
0
0

now all work excellent, thanks for so fast ansver!

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.