error BASS_ChannelGetPosition

Started by Salvo,

Salvo

there is a bug on the position.
link is the demo with the mp3 file, but I think it does it with all mp3 files.

loading an mp3 file, the position is correct with the music being listened to.

But just listen to the first 30 seconds and then click on "GOTO TO 5 SEC", which once 30 seconds are reached the music is 2 seconds behind.

link are the test and mp3 files : https://www.karaoke5.com/public/download/test.zip

.........
if OpenDialog1.Execute then
  begin
    MemChan.Free;
    MemChan := TMemoryStream.Create;
    MemChan.LoadFromFile(PChar(OpenDialog1.FileName));
    BASS_ChannelStop(chan);
    Chan := BASS_StreamCreateFile(True, MemChan.memory, 0, MemChan.size, BASS_STREAM_DECODE);
    Chan := BASS_FX_TempoCreate(Chan, BASS_FX_FREESOURCE);
    BASS_ChannelPlay(chan, True);
    Timer1.Enabled:=True;
  end;

procedure TForm17.Timer1Timer(Sender: TObject);
var posi:Integer;
begin
      posi := Trunc(BASS_ChannelBytes2Seconds(Chan, BASS_ChannelGetPosition(Chan, BASS_POS_BYTE)) * 1000);
      Label1.Text := FormatDateTime('hh:nn:ss.zzz', posi / CostanteM);
end;
.......................

Button "GOTO TO 5 SEC" :
BASS_ChannelSetPosition(chan, BASS_ChannelSeconds2Bytes(chan, 5), BASS_POS_BYTE);

Salvo

#1

Chan := BASS_StreamCreateFile(True, MemChan.memory, 0, MemChan.size, 0);
Even taking off
///Chan := BASS_FX_TempoCreate(Chan, BASS_FX_FREESOURCE);
It gives the same problem.

It does it with this mp3 file zipped on the link.
https://www.karaoke5.com/public/download/test.zip

MB_SOFT

use BASS_STREAM_PRESCAN flag in the BASS_StreamCreateFile call

Salvo

Quote from: MB_SOFTuse BASS_STREAM_PRESCAN flag in the BASS_StreamCreateFile call

It works great.

Thank you