finalize a file - BASS_Encode_MP3_StartFile

Started by Pedro Leonardo,

Pedro Leonardo

Hello.... I currently use the code below to write a file

  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
        BASS_ChannelRemoveDSP(chan3, WMAEncoderDSP3);
        BASS_WMA_EncodeClose(Encoder3);

Now I need to start recording using:

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

Hi, can I finish like this?

BASS_Encode_Stop(chan3);
It worked, but is it correct?

Ian @ un4seen

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.