I cannot get SoundTransform to set the volume.
I have a sound channel set up like this
var sound:Sound = Assets.getSound("Assets/Audio/mainMenu.ogg");
var currentMusic:SoundChannel = sound.play();
var transform:SoundTransform = new SoundTransform();
transform.volume = 0;
currentMusic.soundTransform = transform;
But the volume is still set to full volume.
Well I got the sound transform to work. But when I try to set the volume in my options on the channel in the main class nothing happens.
main.currentMusic.volume = 0 //does nothing
var st= new SoundTransform();
st.volume = 0;
main.currentMusic.soundTransform = st; //does nothing
setting the transform in the main class then modifying from my options class by setting the volume to 0 also does nothing.
How can I set the volume while the sound is playing? It seems I can set it from the start but trying to change it later does nothing.
So it looks like what I am asking not possible? I am unable to find info on why I cannot mute a sound or set the volume while the SoundChannel is playing. Like I said I can set the while when it begins playing but not during, soundChannel.stop() is not what I am looking for.
What platform is this? We may have fixed since the last release, or perhaps this is an issue I’m not aware of
Working on Mac and targeting iOS. In iOS the app crashes when I try to set the volume with the soundTransform. In neko setting the volume has no effect.
In the current development builds, setting the volume is working for me in the “PlayingSound” sample
openfl create PlayingSound
cd PlayingSound
openfl test neko
Clicking or tapping anywhere in the application will cause it to fade out to silent then pause, or play and fade back in. It does use Actuate, but under the hood it really is setting the SoundTransform
object each frame to update.
Would you be able to try this sample, and see if it is working for you on the desktop, with your current version?
Thanks for the pointer on using actuate. That worked! I can toggle my music and sound effects and the iOS verion is not crashing anymore!