Hi Ian,
I uploaded file badseek.wma. For some reason seeking from end of the file does not work until some position.
Here's the code I used:
procedure TForm1.Button1Click(Sender: TObject);
var
h: HSTREAM;
pos: int64;
begin
h := BASS_WMA_StreamCreateFile(False, PChar('badseek.wma'), 0, 0,
BASS_STREAM_DECODE or BASS_UNICODE);
if h <> 0 then begin
pos := BASS_ChannelGetLength(h, BASS_POS_BYTE);
Memo1.Lines.Add(Format('Channel len = %d (%.2f)', [pos, BASS_ChannelBytes2Seconds(h, pos)]));
repeat
if not BASS_ChannelSetPosition(h, pos, BASS_POS_BYTE) then begin
Memo1.Lines.Add(Format('Failed with code %d for position %d (%.2f)', [BASS_ErrorGetCode, pos,
BASS_ChannelBytes2Seconds(h, pos)]));
end else begin
Memo1.Lines.Add(Format('Succeeded for position %d (%.2f)', [pos, BASS_ChannelBytes2Seconds(h, pos)]));
Break;
end;
pos := pos - BASS_ChannelSeconds2Bytes(h, 0.01);
until False;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
BASS_Init(-1, 44100, 0, Form1.handle, nil);
end;
And here's the output:
Channel len = 33186484 (188.13)
Failed with code 7 for position 33186484 (188.13)
Failed with code 7 for position 33184720 (188.12)
Failed with code 7 for position 33182956 (188.11)
Failed with code 7 for position 33181192 (188.10)
Failed with code 7 for position 33179428 (188.09)
Failed with code 7 for position 33177664 (188.08)
Failed with code 7 for position 33175900 (188.07)
Failed with code 7 for position 33174136 (188.06)
Failed with code 7 for position 33172372 (188.05)
Failed with code 7 for position 33170608 (188.04)
Failed with code 7 for position 33168844 (188.03)
Failed with code 7 for position 33167080 (188.02)
Failed with code 7 for position 33165316 (188.01)
Failed with code 7 for position 33163552 (188.00)
Failed with code 7 for position 33161788 (187.99)
Succeeded for position 33160024 (187.98)