## Wave Audio OnDeactivate Method

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

### Wave Audio OnDeactivate Method

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?
FrankHunter
Member

Posts: 2
Joined: June 15th, 2005, 8:27 pm

I wrote a similar code and it worked!
Attachments
MySample.zip
My sample code

Kambiz

Posts: 2429
Joined: March 7th, 2003, 7:10 pm

### Thanks!

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?

FrankHunter
Member

Posts: 2
Joined: June 15th, 2005, 8:27 pm

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.
Kambiz

Kambiz