Click to See Complete Forum and Search --> : seperating sound channels
mlecho
07-24-2008, 09:43 PM
hi -
i have an animation on the stage that works with a SoundMixer.computeSpectrum method. It's fine, but i also have a volume controler on my movie that is effecting the animation. It makes sense but i would like to know how i can pull the volume down to zero, lower all the sound, and still get the animation to continue going, despite not hearing things. Is there a way to seperate the same sound channel to do two different things?
neznein9
07-25-2008, 02:34 AM
Take a look at the soundMixer class, it will let you control the global audio stream after all the sounds have been composited together.
EDIT: just re-read that...are you saying that lowering the volume is affecting animation?
mlecho
07-25-2008, 10:42 AM
exactly what i am saying. The problem is that the way i am controlling the sound animation and the volume control are both be using the same SoundMixer- The solution i would like to find is allowing the user to lower or mute the volume to 0, but still pass the sound waves to "a" SoundMixer instance to keep the animation going event though you would not hear the music.
Essentially a seemless transition in sound only if the user clicks mute, and un-mute. The animation would not be effected in either way.
FWIW (and i always get slapped for not placing entire code classes)-
SOUND VOLUME CODE :
//MATH FOR THE VOLUME
//----------------------------------------------------->>
private function sliderbaseClicked(e:MouseEvent):void
{
var vw=(this.mouseX+30)*.01;
bar.scaleX=vw
setVolume(vw)
}
private function setVolume(num:Number):void
{
var tr:SoundTransform= SoundMixer.soundTransform;
tr.volume=num
SoundMixer.soundTransform=tr;
}
ANIMATION CODE
private function dosoundspectrum(e:TimerEvent):void
{
SoundMixer.computeSpectrum(ba,true)
for(var i=bars.length-1;i>=0;i--)
{
var bm=bars[i];
var f=Math.abs(Math.round((ba.readFloat()*_frequency)) );
setBarY(bm,f);
}
e.updateAfterEvent();
}
private function setBarY(bm,f:Number):void
{
var tgY=-f*8 //calculate target y
var curY=bm.y; //track current y
var dy=(tgY-curY)*.5 //find difference and add ease (.2)
//bm.y+=dy //concatonate the calculated to the current position
bm.y=tgY
}
jon ps
08-18-2008, 03:30 PM
Hi Mlecho,
did you ever figure out a solution to this? I've just posted a similar thread, and then noticed yours here
Ta
mlecho
08-19-2008, 12:06 PM
Actually, no. The client decided they preceded the visual to mute with the music. There mustbe a way to seperate the byte array from the soundmixer class. Let me know if find it!!! Still unresolved
jon ps
08-19-2008, 02:08 PM
Thanks for the update mlecho.
Any takers out there on this?
flashkit.com
Copyright Internet.com Inc., All Rights Reserved.