Author Topic: Play Pause Stop  (Read 678 times)

Cafony

  • Posts: 33
Play Pause Stop
« on: 13 May '24 - 09:59 »
Hello I got this player

Code: [Select]
_musicFile = myFuntions.openFileTz();
_stream = Bass.BASS_StreamCreateFile(_musicFile, 0L, 0L, BASSFlag.BASS_STREAM_DECODE);       
//Stream for PITCHSHIFT
_streamPitch = Bass.BASS_ChannelSetFX(_stream, BASSFXType.BASS_FX_BFX_PITCHSHIFT, 0);
//Stream for MONO STEREO
_streamMono = Bass.BASS_ChannelSetFX(_stream, BASSFXType.BASS_FX_BFX_MIX, 0);
//Stream for TEMPO, usamos este stream por cause do pitch
_streamSpeed = BassFx.BASS_FX_TempoCreate(_stream, BASSFlag.BASS_STREAM_AUTOFREE);

Now when I do Play:
Code: [Select]
Bass.BASS_ChannelPlay(_streamSpeed, false);

When Pause:
Code: [Select]
Bass.BASS_ChannelPause(_streamSpeed);

When doing Stop I have :
Code: [Select]
Bass.BASS_ChannelStop(_streamSpeed);

The problem is:
- When I do stop I can not do play again.
- cause theres no sound.
- the initial stream is _stream
- and the play is on _streamSpeed

How can I make "stop and play" whitout open the file again.

Thanks


Ian @ un4seen

  • Administrator
  • Posts: 26172
Re: Play Pause Stop
« Reply #1 on: 13 May '24 - 17:29 »
The BASS_STREAM_AUTOFREE flag in the BASS_FX_TempoCreate call means the tempo stream (_streamSpeed) will be freed when BASS_ChannelStop is called on it. So you should remove that flag if you don't want that to happen, and instead call BASS_StreamFree when you're finished with the stream. Note the source stream (_stream) will need to be freed too. You can have that happen automatically when the tempo stream is freed by including the BASS_FX_FREESOURCE flag in the BASS_FX_TempoCreate call.

Cafony

  • Posts: 33
Re: Play Pause Stop
« Reply #2 on: 13 May '24 - 23:29 »
I change the flag to Freesource:
Code: [Select]
            _streamSpeed = BassFx.BASS_FX_TempoCreate(_stream, BASSFlag.BASS_FX_FREESOURCE);

and now the "stop" does not work, it behaves like a "pause" button.

Code: [Select]
            Bass.BASS_ChannelStop(_streamSpeed);

Ian @ un4seen

  • Administrator
  • Posts: 26172
Re: Play Pause Stop
« Reply #3 on: 14 May '24 - 16:08 »
Stopping is basically the same thing as pausing, ie. both stop playback (but the BASS_STREAM_AUTOFREE flag doesn't apply to pausing). Please describe what you are expecting to be different.