Recent

Author Topic: BASS not clearing Channel  (Read 1451 times)

QEnnay

  • Full Member
  • ***
  • Posts: 115
BASS not clearing Channel
« on: May 23, 2020, 04:57:44 pm »
Hi, I am getting multiple tracks playing at once. The OnBtnPlayClick and OnBtnStopClick events have this in them in part.

Code: Pascal  [Select][+][-]
  1. // PLAY
  2.   if (Channel <> 0) then
  3.     btnTrackStopClick(btnTrackStop);
  4.   Channel:=BASS_StreamCreateFile(
  5.     False,           // memory
  6.     PChar(strTrack), // file
  7.     0,               // offset
  8.     0,               // length
  9.     0                // flags
  10.     );
  11.   if (Channel = 0)  then
  12.   begin
  13.     ShowMessage('Error Loading File');
  14.   end else
  15.   begin
  16.     BASS_ChannelPlay(Channel,False);
  17.  

Code: Pascal  [Select][+][-]
  1. // STOP
  2. var
  3.   bTemp : Boolean;
  4. begin
  5.   Timer1.Enabled:=False;
  6.   bTemp:=BASS_ChannelStop(Channel);
  7.   bTemp:=BASS_StreamFree(Channel);
  8.  

But after that both times the "bTemp" equals "True" and "Channel" is still a very large int-number.

Can I just add "Channel:=0;" at the end or is that tempting memory leaks etc?

Thanks for looking.
Linux-Mint 20.1 x64 + Cinnamon; Lenovo Flex 5 Ryzen 5 4500, 16GB memory
FPC: 3.2.0-1, Lazarus 2.0.12-0, all 64bit

QEnnay

  • Full Member
  • ***
  • Posts: 115
Re: BASS not clearing Channel
« Reply #1 on: May 23, 2020, 05:40:21 pm »
OK, it seems to be a BASS thing. I loaded the Delphi example "Basstest" and loaded 2 .WAV files into the listbox.

I clicked the first .WAV and Play.
I immediately clicked the second .WAV and Play again.

Voilà, double the fun.

Linux-Mint 20.1 x64 + Cinnamon; Lenovo Flex 5 Ryzen 5 4500, 16GB memory
FPC: 3.2.0-1, Lazarus 2.0.12-0, all 64bit

 

TinyPortal © 2005-2018