Hi folks,
I've got two sound instances - sndMusic & sndNarration. I'd like the music to play initially, then fade out before the narration starts.
I am adding the following tweens to the timeline of my main application (MyVideo)...
//////////////////////////////////////////////////////////////////////////
this.timeline.addTween(cjs.Tween.get(sndMusic)
.call(sndMusic.play) // Play music
.wait(200) // for 200 frames
.to({volume:0}, 50)); // Reduce volume to 0 over a period of 50 frames
this.timeline.addTween(cjs.Tween.get(sndNarration)
.wait(250) // Wait until music has finished
.call(sndNarration.play)); // Start narration
//////////////////////////////////////////////////////////////////////////
The music plays, but does not fade out before the narration starts.
If I print out the value of sndMusic.getVolume() between frames 200-250, my eyes tell me that the volume of sndMusic gradually reduces to zero. Trouble is my ears don't agree!
Where am I going wrong?
Here's some more code, in case it helps. Thanks
///////////////////////////////////////////////////////
function init() {
canvas = document.getElementById("canvas");
stage = new createjs.Stage(canvas);
// Preload sound
var manifest = [
{src:"sndMusic.mp3", id:"sndMusic"},
{src:"sndNarration.mp3", id:"sndNarration"}];
var loader = new createjs.LoadQueue(false);
loader.installPlugin(createjs.Sound);
loader.addEventListener("complete", handleComplete);
loader.loadManifest(manifest);
}
function handleComplete() {
// Initialise sounds
sndMusic = createjs.Sound.createInstance("sndMusic");
sndNarration = createjs.Sound.createInstance("sndNarration");
// Start the video
myVideo= new lib.MyVideo();
stage.addChild(myVideo);
}