Author Topic: finalize a file - BASS_Encode_MP3_StartFile  (Read 57 times)

Pedro Leonardo

  • Posts: 91
finalize a file - BASS_Encode_MP3_StartFile
« on: 24 Sep '24 - 20:44 »
Hello.... I currently use the code below to write a file

Code: [Select]
  Encoder3 := BASS_WMA_EncodeOpenFile(Info.freq, Info.chans, BASS_SAMPLE_FLOAT OR BASS_UNICODE , vBitRate3, PChar('nome_do_arquivo.mp3'));
  WMAEncoderDSP3 := BASS_ChannelSetDSP(chan3, @RecordDSPCallback3, Pointer(Encoder3), 0);

and to finish I use
Code: [Select]
        BASS_ChannelRemoveDSP(chan3, WMAEncoderDSP3);
        BASS_WMA_EncodeClose(Encoder3);

Now I need to start recording using:

Code: [Select]
Encoder3 :=  BASS_Encode_MP3_StartFile(chan3, '-b32', BASS_ENCODE_AUTOFREE or BASS_UNICODE, PChar('nome_do_arquivo.mp3') );

How do I finish recording?

        BASS_ChannelRemoveDSP(chan3, WMAEncoderDSP3);
        BASS_WMA_EncodeClose(Encoder3);

does not work.
Regards


Pedro Leonardo

  • Posts: 91
Re: finalize a file - BASS_Encode_MP3_StartFile
« Reply #1 on: 24 Sep '24 - 21:04 »
Hi, can I finish like this?

Code: [Select]
BASS_Encode_Stop(chan3);
It worked, but is it correct?

Ian @ un4seen

  • Administrator
  • Posts: 26079
Re: finalize a file - BASS_Encode_MP3_StartFile
« Reply #2 on: 25 Sep '24 - 13:19 »
Yes, BASS_Encode_Stop is the correct way to finalise a BASSenc encoding. As you've set BASS_ENCODE_AUTOFREE on the encoder, it would also be finalised when the source (chan3) is freed.