Page 1 of 1

StockAudioPlayer - Start playing wave in the middle

PostPosted: December 4th, 2006, 2:14 am
by jvoelker
Great components! I am having a problem with StockAudioPlayer. I want to start playing a wave file in the middle but when I do, the position counter does not work. The value of StockAudioPlayer.position does not match the position being played.

As a demonstration, I added these lines to the Demo Sound Recorder:

procedure TMainForm.btnPlayClick(Sender: TObject);
begin
StockAudioPlayer.PlayFile(WaveFile.Caption);
StockAudioPlayer.WaitForStart;
StockAudioPlayer.Paused := True;
StockAudioPlayer.Position := 2000;
StockAudioPlayer.Paused := False;
end;

If you record a 10 second clip and click play, the wave file starts playing 2 seconds into the file as it should but the value of StockAudioPlayer.position shows that it starts at zero and ends at 8.

I am using a trackbar to show the position in the file but it does not work because of this if I start playing the wave file in the middle.

Is this intended or a bug?

Thanks.

Jim Voelker

PostPosted: December 5th, 2006, 1:31 am
by Kambiz
That's a bug and would be fixed on the next release. As you said, the wave plays as expected but the initial offset is not included in the reported position.

Thank you for reporting it.