Author Topic: Fade then stop example (Delphi)  (Read 8597 times)

sam_fisher

  • Guest
Fade then stop example (Delphi)
« on: 25 Aug '03 - 11:04 »
Is there any way to fade then stop a stream without halting the application in the process ? I am using the below code on a button and it works but while the code is running my application is halted and I am hoping there is a better method. Anyway here is the code


procedure TForm1.stop_btnClick(Sender: TObject);
Begin
BASS_ChannelSlideAttributes(stream,-1,-2,-101,1000);
While BASS_ChannelIsSliding(stream) <> 0 Do
begin
Process Events
end;
BASS_ChannelStop(stream);
BASS_StreamFree(stream);
End;

Irrational86

  • Posts: 960
Re: Fade then stop example (Delphi)
« Reply #1 on: 25 Aug '03 - 23:16 »
replace
Pricess Events with this line:

Application.ProcessMessages;

AndrewJameson

  • Guest
Re: Fade then stop example (Delphi)
« Reply #2 on: 26 Aug '03 - 12:24 »
Sorry ... not got the time to look into this but there must be an event callback that's relevant to solve this problem ... but you must avoid calls to Application.ProcessMessages at all costs, it's far from a ideal solution and can result in all sorts of problems ...

If you look at this loop ...

While BASS_ChannelIsSliding(stream) <> 0 Do
begin
Process Events
end;
... it'll consume 100% CPU resources !!!

Andrew

(If there's no answer shortly then I'll look into how it's done ... but someone else will know the answer ?)

Ian @ un4seen

  • Administrator
  • Posts: 20401
Re: Fade then stop example (Delphi)
« Reply #3 on: 26 Aug '03 - 15:44 »
Instead of waiting in a loop, you could use a sync (BASS_SYNC_SLIDE).