I'm searching for an algorythm for crossfading

Started by
2 comments, last by NoradX 22 years, 10 months ago
Hi I'm searching for an allgorythim for crossfading without changing the volume. I've 3 Mp3z, one main mp3, one with strings and one with bass for example, but all mp3z are the same song. It should sound like games from Lucasarts(Monkey Island etc.). The sound shows the actually mood of the character. I'm using OpenGL and C++. I just want an algorhytm for direct sound or a general algorhytm. Hope you will help me. Thanks. Edited by - Noradx on June 12, 2001 1:01:03 PM
Advertisement
Oh I''m useing OpenGL and C++.
It would be great if the code is written for direct sound, but general algorythms are also OK.

Thanks again.
Can you explain what "crossfading" means????
At first I thought you were talking about making a fade out graphical effect, making it fade like a growing cross!.

What the hells!
What the hells!
It''s been a long time since I''ve looked at directsound, but I would imagine it would go something like this:

either:
I thought you couple simply mix sound without raising the overall volume. ie. if you have two sources at full volume, it should be a mix/overlay, not really louder...

or:
if that''s not true, think of full volume at 1.0. When Source A is the only thing playing, it''s volume is 1.0, Source B is at 0.0. When the fade it midway, A = 0.5, B = 0.5. To put it simply, the algorithm just makes sure A + B = 1.0. So, over time, think of a variable AmountOfFade (from A to B).
Volume A = 1.0 - AmountOfFade
Volume B = AmountOfFade
Now, set that up and send it to the mixer...
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials

This topic is closed to new replies.

Advertisement