Page 1 of 1

Wave Audio OnDeactivate Method

PostPosted: June 15th, 2005, 8:31 pm
by FrankHunter
Hi, this is an excellent product, thank you!

My question is that the StockAudioPlayer is connected to a WaveCollection with 2 songs. The first one is started in my FormCreate event. The second is supposed to start when the first ends. So I have the line

StockAudioPlayer1.PlayStock(1);

in the StockAudioPlayer's OnDeactivate Event. I know the event is called because I put a breakpoint there to check. But the song never plays.

Any idea what I'm doing wrong?

PostPosted: June 16th, 2005, 7:24 am
by Kambiz
I wrote a similar code and it worked! :roll:

Thanks!

PostPosted: June 16th, 2005, 5:10 pm
by FrankHunter
Thanks, all fixed.

One other question, is it possible to load the wav files into a WaveCollection component in the FormCreate or do the wav files have to be pre-loaded?

If they can be loaded at runtime what is the code?

Sounds.Waves.Add(FileName) ??

PostPosted: June 16th, 2005, 6:45 pm
by Kambiz
First you should add a new WaveItem to WaveCollection, then load the wave file in to the Wave property of the WaveItem.

All can be done in a single line as follow:

Code: Select all
Sounds.Waves.Add.Wave.LoadFromFile(FileName);

Please look at the Wave Audio package's document for TWaveCollection properties for detailed description.