Start playing a WAV file from a specified position

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

Start playing a WAV file from a specified position

Postby wilhelms@intekom.co.za » May 21st, 2007, 12:09 pm

Could you please give me some advice on your TStockAudioPlayer component? I need to start playing a WAV file from a specified position, not from the beginning. Is this possible?
wilhelms@intekom.co.za
Active Member
Active Member
 
Posts: 7
Joined: May 21st, 2007, 11:54 am

Postby Kambiz » May 21st, 2007, 1:16 pm

  1. set Paused property to True
  2. call PlayFile method
  3. set Position property
  4. set Paused property to False
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby wilhelms@intekom.co.za » May 21st, 2007, 1:45 pm

Thanks, but I can't get this to work. The documentation say that Position is read only.

I tried adding this code to a new button's OnClick event handler in your SndRcrdr demo project:

StockAudioPlayer.Paused := true;
StockAudioPlayer.PlayFile(WaveFile.Caption);
StockAudioPlayer.Position := 5000;
StockAudioPlayer.Paused := false;

But it just starts playing the WAV from the start.
wilhelms@intekom.co.za
Active Member
Active Member
 
Posts: 7
Joined: May 21st, 2007, 11:54 am

Postby wilhelms@intekom.co.za » May 21st, 2007, 1:57 pm

I forgot to mention: The wav is more than 5000 milliseconds long.

Many thanks for your help

Regards

Wilhelm
wilhelms@intekom.co.za
Active Member
Active Member
 
Posts: 7
Joined: May 21st, 2007, 11:54 am

Postby Kambiz » May 21st, 2007, 2:27 pm

I was forgotten that recently I changed the behavior, sorry.
Please go in this way:

Code: Select all
StockAudioPlayer1.Position := 5000;
StockAudioPlayer1.PlayFile('test.wav');


The previous method didn't work because of a bug.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Sound interference

Postby wilhelms@intekom.co.za » May 21st, 2007, 4:41 pm

This does play the wav from the specified position, but unfortunately with interferance in the sound. I have attached a zip file including my modifications to your demo code. I will appreciate if you are able to have a look at this.

Regards

Wilhelm
Attachments
SndRcrdr.zip
(241.1 KiB) Downloaded 347 times
wilhelms@intekom.co.za
Active Member
Active Member
 
Posts: 7
Joined: May 21st, 2007, 11:54 am

Postby Kambiz » May 21st, 2007, 5:38 pm

Your sample works as expected with no problem. :!:
What's version of your Wave Audio package?
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby wilhelms@intekom.co.za » May 21st, 2007, 6:48 pm

It is v1.82, compiled in Delphi 7.0, run on Win XP.
Have you tried the exe that I included in the zip? It gave the same problem on two different computers, with two different wav files. Can I email to you the wav file that I tested with? It is too large to upload to this forum.
wilhelms@intekom.co.za
Active Member
Active Member
 
Posts: 7
Joined: May 21st, 2007, 11:54 am

Postby Kambiz » May 21st, 2007, 10:42 pm

Even your executable file works properly.

Yes, please send me your wave files via email.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby wilhelms@intekom.co.za » May 22nd, 2007, 7:21 am

Thanks Kambiz, I have mailed the WAV to you.
wilhelms@intekom.co.za
Active Member
Active Member
 
Posts: 7
Joined: May 21st, 2007, 11:54 am

Postby Kambiz » May 22nd, 2007, 10:44 am

I got the wave file, and I could see the problem.
Seems the problem is in converting millisecounds to byte offset. I'll let you know when I fixed the bug.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby Kambiz » May 22nd, 2007, 11:48 am

I resolved the problem. The bug was inside one of basic functions that was used in several parts of the package.

Please download the Wave Audio package v1.84.

Thank you
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Wave Audio package v1.84

Postby wilhelms@intekom.co.za » June 6th, 2007, 10:20 am

Many thanks Kambiz. I will download it.

Best regards

Wilhelm
wilhelms@intekom.co.za
Active Member
Active Member
 
Posts: 7
Joined: May 21st, 2007, 11:54 am


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 0 guests

cron