Adam
Adam

Reputation: 65

AS3 Changing volume level on left/right speaker without affecting the other

I need to know if it is possible to changed the volume level of an individual stereo/sound channel using as3? Basically i need to be able to turn the right channel volume down without affecting the left channel?

I've already been looking at the pan method and rightToRight/rightToLeft methods available in the soundtransform class but i can't seem to get it to do what i want?

Any help on this one would be hugely appreciated!

Thanks Adam

Upvotes: 2

Views: 242

Answers (1)

Marcela
Marcela

Reputation: 3738

Since you didn't post any code showing how you are using the rightToRight/rightToLeft properties, I'll give it a stab with how I would do it:

var sound:Sound = new SomeSound();
var soundChannel:SoundChannel = sound.play();
var soundTX:SoundTransform = soundChannel.soundTransform;
soundTX.leftToLeft = .1; // set the volume lower on the left channel
soundTX.leftToRight = 0; // make sure the left channel is only playing on the left
soundTX.rightToLeft = 0; // (see above)
soundTX.rightToRight = .3; // set the volume to a slightly higher value than the left
soundChannel.soundTransform = soundTX; // apply the modified soundTransform on soundChannel

Upvotes: 3

Related Questions