Page 1 of 1

Newbie Question on Usage of Audio Mixer

PostPosted: May 10th, 2009, 6:46 am
by Brad
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.

Re: Newbie Question on Usage of Audio Mixer

PostPosted: May 10th, 2009, 1:54 pm
by Kambiz
You have Wave Length, Current Playing Position, and Wave Volume.
Use a timer to set the playing volume according to the current playing position.

Re: Newbie Question on Usage of Audio Mixer

PostPosted: May 11th, 2009, 6:01 am
by Brad
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

Re: Newbie Question on Usage of Audio Mixer

PostPosted: May 11th, 2009, 8:54 am
by Kambiz
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.

Re: Newbie Question on Usage of Audio Mixer

PostPosted: May 12th, 2009, 10:43 pm
by Brad
Thanks Kambiz.

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

Brad

Re: Newbie Question on Usage of Audio Mixer

PostPosted: May 15th, 2009, 3:40 pm
by Kambiz
The attached example plays two waves simultaneously and calculates the first 50 Fibonaci numbers while waves are still playing.

Re: Newbie Question on Usage of Audio Mixer

PostPosted: May 15th, 2009, 4:13 pm
by Brad
Thanks very much Kambiz.

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

Kindest Regards,

Brad