0
0

hi all,
im new to fmod but im reading here alot and trying alot.
And i get a whole bunch of stuff working.

But i think i do something wrong or i did misunderstood something.
I have a channel created like this:

[code:1cr2q8qs]
var
i:integer;
begin

result := FMOD_System_Create(system);
ErrCheck(result);

result := FMOD_System_GetVersion(system, version);
ErrCheck(result);

if (version < FMOD_VERSION) then begin
showmessage(Format(’Error! You are using an old version of FMOD %.8x. This program requires %.8x’, [version, FMOD_VERSION]));
end;

result := FMOD_System_SetSpeakerMode(system, FMOD_SPEAKERMODE_7POINT1);
ERRCHECK(result);

result := FMOD_System_Init(system, 32, FMOD_INIT_NORMAL, nil);
ERRCHECK(result);

result := FMOD_System_CreateSound(system, ‘H://1.mp3’, (FMOD_SOFTWARE or FMOD_2D), nil, playerm.sound);
ERRCHECK(result); //if i dont do this here it says it has problems when it comes to the dsps

  //Init Player

result := FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, playerM.sound, true, playerM.channel);
ERRCHECK(result);
result := FMOD_Channel_SetSpeakerMix(playerM.channel, 1, 1, 0, 0, 0, 0, 0, 0);
ERRCHECK(result);
for i:=0 to 13 do //some equalizer stuff and here it got problems
begin
FMOD_System_createDSPByType(system, FMOD_DSP_TYPE_PARAMEQ, playerM.eq_band[i]);
ErrCheck(result);
result:= FMOD_Channel_addDSP(playerm.channel,playerm.eq_band[i]);
ERRCHECK(result);
end;

end;
[/code:1cr2q8qs]

but when i now want that the player plays another track, i call it in that way:

[code:1cr2q8qs]

result := FMOD_System_CreateSound(system, Pchar(song), (FMOD_SOFTWARE or FMOD_2D) and FMOD_CREATESTREAM , nil, playerm.sound);
ERRCHECK(result);
result := FMOD_System_PlaySound(system, FMOD_CHANNEL_REUSE, playerm.sound, true, playerm.channel);
ERRCHECK(result);

result:=FMOD_Channel_setpaused(playerm.Channel, false);
ERRCHECK(result);
result:=FMOD_Channel_setPosition(playerm.Channel, 0,FMOD_TIMEUNIT_MS);
ERRCHECK(result);
[/code:1cr2q8qs]

it takes very long till he creates the sound. and freezes for a short time the window.
but if i dont create it again it will play the old song.

What do i do wrong?

Thanks in advance,
Julian

  • You must to post comments
0
0

nobody sees possible errors?
or what can make it so long 😉

  • You must to post comments
0
0

I don’t know Delphi but I think your problem might be here:

[code:3qiecdx5]FMOD_System_CreateSound(system, ‘H://1.mp3’, (FMOD_SOFTWARE or FMOD_2D), nil, playerm.sound);[/code:3qiecdx5]

The FMOD_CREATESTREAM Isn’t used, so it is loading the file into memory (takes a long time), Also, I don’t think you need to specify FMOD_2D if you are using FMOD_SOFTWARE

And here:

[code:3qiecdx5]result := FMOD_System_CreateSound(system, Pchar(song), (FMOD_SOFTWARE or FMOD_2D) and FMOD_CREATESTREAM , nil, playerm.sound); [/code:3qiecdx5]

Not sure about Delphi, but shouldn’t the flags all be OR’d?

  • You must to post comments
0
0

yeah your right i use now CreateStream instead of CreateSound and its working alot faster, thank you.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.