Change Tone in every panorama item

173 Views Asked by At

I'm using XNA framework in my application and I try to build panorama application. I want to use different tone in every panorama item, yeah it's work nicely. But when i try to slide panorama item 1 to panorama item 2 the tone is not change (the tone in panorama item 2 still using tone panorama item 1).

this is my simple code :

        Stream stream = TitleContainer.OpenStream("Sounds/A.wav");
        SoundEffect effect = SoundEffect.FromStream(stream);
        FrameworkDispatcher.Update();
        effect.Play();

i've try using this code in every panorama item to stop the tone before it sliding :

        using (var stream = TitleContainer.OpenStream("Sounds/A.wav")) 
        //panorama item 2 using ("Sounds/B.wav")) 
        {
            effect = SoundEffect.FromStream(stream);
            //create the instance 
            effectStop = effect.CreateInstance();

            FrameworkDispatcher.Update();
            //play sound via the instance 
            effectStop.Play();
        }

        //some event called to stop sound 
        effectStop.Stop();

but the code above just stop the tone and won't playing the tone before it sliding. Anyone know how i fix this thing?

0

There are 0 best solutions below