Newbie Question on Usage of Audio Mixer

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

Newbie Question on Usage of Audio Mixer

Postby Brad » May 10th, 2009, 6:46 am

Great Product....

I'm converting over to D2009 and from using DSMIXER. I'm just a bit unclear on just how to go about this.

In my product, I have a very flexible music scheduler with a player. I come from a Radio background and used the mixer component to create multiple players. Using a timer, I would display several count up / count down clocks and would use the length to show alarms and to allow mixing up and mixing down with a "second" player and the ability to play a sound effect or voice track from a "third" player simultaneous.

I would like to get your direction on how to utilize your components. I've been reading up on them and their properties but I'm a bit confused (somewhat easy to do :oops: ).

I would like to load one player with an error message. Another with the selected .wav file. And another with a Qued .wav file. My player program does this by calling a .play command on the first player (created on initialize and attached to the mixer).

How would you suggest that I have a player and play the .wav file and 10 seconds before the end, fade down the volume on the first wave file and begin playing and fade up the second wave file??

Thanks for your help and I look forward to learning.

Kindest Regards,

Brad Hillyard
Rocky Peak Software

PS - I learned some good things from your example.
Brad
Member
Member
 
Posts: 4
Joined: May 7th, 2009, 7:22 am

Re: Newbie Question on Usage of Audio Mixer

Postby Kambiz » May 10th, 2009, 1:54 pm

You have Wave Length, Current Playing Position, and Wave Volume.
Use a timer to set the playing volume according to the current playing position.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Newbie Question on Usage of Audio Mixer

Postby Brad » May 11th, 2009, 6:01 am

Thanks Kambiz.

Just another quick clarification. I have it playing. I was just having a problem now with this-

I create one wavefile instance like this

AUDIO1 := TWAVEFILE.CREATE(TESTFILENAME, fmOpenRead or fmShareDenyWrite);
PLAYER1.PlayFile(TESTFILENAME);

Then I create another wavefile like this

AUDIO2 := TWAVEFILE.CREATE(ERRORFILENAME, fmOpenRead or fmShareDenyWrite);
PLAYER2.PlayFile(ERRORFILENAME);

Then I proceed to complete the startup of the program and the testfile wave plays but the error file will not play.

In the past I have been able to play the test file with player1 and the errorfile in the player2

With the other code, I assisgned player1 and player2 to a mixer. Is this what I have to do here (regardless of the code for accomplishing the fading and the timing) to get an overlap??

If you could just show a quick snip of code on what I might be missing it would be helpful.

Thanks again and Kindest Regards,

Brad
Brad
Member
Member
 
Posts: 4
Joined: May 7th, 2009, 7:22 am

Re: Newbie Question on Usage of Audio Mixer

Postby Kambiz » May 11th, 2009, 8:54 am

Be sure two players are threaded. You may need to call WaitForStart of players.

I personally prefer to mix the two wave files into a single wave, and play it. TStreamWaveAdapter class has a method for this purpose.
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Newbie Question on Usage of Audio Mixer

Postby Brad » May 12th, 2009, 10:43 pm

Thanks Kambiz.

Do you know of an example showing how to do the two threads?? Sorry I'm new to this...

Brad
Brad
Member
Member
 
Posts: 4
Joined: May 7th, 2009, 7:22 am

Re: Newbie Question on Usage of Audio Mixer

Postby Kambiz » May 15th, 2009, 3:40 pm

The attached example plays two waves simultaneously and calculates the first 50 Fibonaci numbers while waves are still playing.
Attachments
PlayTwoWaves.zip
Example of playing two waves simultaneously
(78.98 KiB) Downloaded 143 times
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Newbie Question on Usage of Audio Mixer

Postby Brad » May 15th, 2009, 4:13 pm

Thanks very much Kambiz.

I am very thankful for the example. It will help a great deal!

Kindest Regards,

Brad
Brad
Member
Member
 
Posts: 4
Joined: May 7th, 2009, 7:22 am


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 2 guests

cron