|
FMOD, FMOD. Firelight Technologies Pty, Ltd. FMOD 3.74. , , www.FMOD.org. FMOD . FMOD . FMOD API , , . API web-. , , (3D) . . , FMOD, , , . C (). 3D FMOD ( Windows) : WMM (Windows Multimedia), DirectSound3D ( Microsoft DirectX) A3D. FMOD , ( ). DirectSound3D FMOD , , . FMOD ( ) API ( DirectSound3D DirectSound3D). FMOD - , , dll , FMOD . 3.74, Windows 32- dll, 64- FMOD. FMOD ( ) VisualC, BorlandC, Watcom C, Borland Delphi VisualBasic. FMOD . FMOD ( DirectSound3D), ( , FMOD , ). FMOD( ), 3D , DirectSound3D. , . X () ; Y () ; Z () ( , ). , , . , X, Y, Z. , . XYZ, , , , (0, 0, 0), (X, Y, Z). , FMOD , . ( (0, 0, 0)). , FMOD ( DirectSound3D) . , FMOD , . FMOD ( DirectSound3D) , (), . FMOD, , , (float) , , (float) . FMOD: /* */ float pos[3] = {10.0f, 2.0f, 4.2f}; /* */ struct VECTOR { float X; float Y; float Z; }; VECTOR pos = {10.0f, 2.0f, 4.2f}; FMOD , . FMOD . FMODFMOD : . DirectSound3D, FMOD . . FMOD , . , , . . , , . , . , ( ). 3DFMOD, , , , FMOD. , , FMOD. , FMOD "FSOUND API Reference".
, , .., . FMOD, (3D) . , , . (, ) (, "" ). , , . , , , , . FMOD, : FSOUND_SetOutput, FSOUND_SetDriver FSOUND_SetMixer. FSOUND_SetOutput -1 (0FFFFFFFFh). FMOD . FSOUND_Sample_Load, , , , .mp3 wav. FMOD, , DirectSound. FSOUND_Sample_Load , . DirectSound, . 3D , . , , . , , FSOUND_PlaySound FSOUND_PlaySoundEx, , - , . , (Listener), (, , , ). , FSOUND_PlaySoundEx() , . , , . , FSOUND_Update. , FMOD (channel), , 3D , , , . . FSOUND_PlaySoundEx : int F_API FSOUND_PlaySoundEx( int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dspunit, signed char startpaused ); (channel), ,; ( sptr) , ; ( dspunit) , ( NULL); (paused), TRUE, . , channel FSOUND_FREE. , , channel FSOUND_ALL. () , . , -1 (0FFFFFFFFH). () , , FSOUND_3D_SetAttributes. , : FSOUND_SAMPLE *samp1 = NULL; int channel1 = -1; /* FMOD */ if (FSOUND_GetVersion() < FMOD_VERSION) { /* */ return 1; } /* DirectSound */ FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); /* */ FSOUND_SetDriver(0); /* FMOD */ FSOUND_SetMixer(FSOUND_MIXER_AUTODETECT); /* FMOD */ /* , , - 22050 */ /* - 32 */ if (!FSOUND_Init(22050, 32, 0)) { /* */ return 1; } /* myfile.wav */ /* FSOUND_HW3D , 3D */ samp1 = FSOUND_Sample_Load(FSOUND_FREE, "myfile.wav", FSOUND_HW3D, 0, 0); if (!samp1) { /* */ return 1; } /* , .. */ /* */ FSOUND_Sample_SetMode(samp1, FSOUND_LOOP_NORMAL); /* */ float pos[3] = { -10.0f, -20.0f, 0.5f }; float vel[3] = { 0,0,0 }; /* */ /* */ channel1 = FSOUND_PlaySoundEx(FSOUND_FREE, samp1, NULL, TRUE); if (channel1 == -1) { /* */ return 1; } /* */ FSOUND_3D_SetAttributes(channel1, pos, vel); /* */ . . . /* */ FSOUND_Update(); /* */ FSOUND_SetPaused(channel1, FALSE); . . . , FSOUND_PlaySound FSOUND_PlaySoundEx , , channel () , , , FSOUND_3D_SetAttributes , , . , FSOUND_PlaySoundEx , FSOUND_3D_GetAttributes. FSOUND_PlaySoundEx ; , , . , , ( , , ). , FSOUND_3D_Listener_SetAttributes. : void F_API FSOUND_3D_Listener_SetAttributes( const F_FLOAT_API *pos, const F_FLOAT_API *vel, F_FLOAT_API fx, F_FLOAT_API fy, F_FLOAT_API fz, F_FLOAT_API tx, F_FLOAT_API ty, F_FLOAT_API tz ); (pos), (vel), X, Y Z , (fx, fy, fz); X, Y Z , (tx, ty, tz). void, , , TRUE, , FALSE . DirectSound3D, FMOD , . , . FSOUND_3D_Listener_SetCurrent. , , FSOUND_Sample_Free, () , FSOUND_Close, FMOD. FSOUND_Sample_Free(samp1); FSOUND_Close(); FMOD, , TRUE . , FALSE. , FSOUND_GetError FMOD_ErrorString. , FMOD_errors.h. FSOUND_GetError , FMOD. FMOD_ErrorString . : /* */ printf("Error: %s\n", FMOD_ErrorString(FSOUND_GetError())); . 100 3D , - . "" . , , . FMOD FSOUND_SetMinHardwareChannels. FSOUND_Init , . FSOUND_SetMinHardwareChannels , . , , 16 , . , 4 , . FMOD . , , . , , , , , . () FSOUND_SetPriority. , . , FMOD . , FMOD. , FMOD. |
||
|