0
0

ChannelIsPlaying function:
[code:1e4us8nb]
function ChannelIsPlaying(AChannel: FMOD_CHANNEL): Boolean;
var
C_Playing: FMOD_BOOL;
begin
C_Playing := False;

if AChannel <> nil then
begin
retorno := FMOD_Channel_IsPlaying(AChannel, C_Playing);

if (retorno &lt;&gt; FMOD_OK) and (retorno &lt;&gt; FMOD_ERR_INVALID_HANDLE) and
   (retorno &lt;&gt; FMOD_ERR_CHANNEL_STOLEN) then
begin
  ERRCHECK(retorno);
end;

end;

Result := C_Playing;
end;[/code:1e4us8nb]

Play sound1 two times WITH EFFECT on Button Click:
[code:1e4us8nb]
procedure TForm1.Button1Click(Sender: TObject);
begin
retorno := FMOD_System_PlaySound(sys, FMOD_CHANNEL_REUSE, Sound1, True, Channel1);
ERRCHECK(retorno);

retorno := FMOD_System_PlaySound(sys, FMOD_CHANNEL_REUSE, Sound1, True, Channel2);
ERRCHECK(retorno);

retorno := FMOD_Channel_AddDSP(Channel1, dspEcho);
ERRCHECK(retorno);

retorno := FMOD_Channel_AddDSP(Channel2, dspEcho);
ERRCHECK(retorno);
FirstTime := True;

retorno := FMOD_Channel_SetPaused(Channel1, False);
ERRCHECK(retorno);

retorno := FMOD_Channel_SetPaused(Channel2, False);
ERRCHECK(retorno);
end;
[/code:1e4us8nb]

Timer to check if channels are playing:
[code:1e4us8nb]
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if sys <> nil then
begin
retorno := FMOD_System_Update(sys);
ERRCHECK(retorno);
end;

if ChannelIsPlaying(Channel1) then
Label1.Caption := ‘Yes’
else
Label1.Caption := ‘No’;

if ChannelIsPlaying(Channel2) then
Label2.Caption := ‘Yes’
else
Label2.Caption := ‘No’;
end;
[/code:1e4us8nb]

Question: Why Channel1 is still with "playing state" after it ends?

Note: I need to know all channels states.

  • You must to post comments
0
0

Possible memory leak when playing sounds with DSP?

Make the test:

1 – Play sound1 on Channel1 (paused)
2 – Play sound1 on Channel2 (paused)
3 – Add DSP on Channel1 and Channel2
4 – Unpause Channel1 and Channel2
5 – Check channels states…

I’m using FMOD Ex 4.04.43

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.