Play two sounds simultaneusly

前端 未结 6 1136
时光取名叫无心
时光取名叫无心 2020-11-27 05:09

Is there a way to play two sounds at the same time?

I know that SoundPlayer isn\'t able to do this. I can\'t use SoundEffect as I believe i

6条回答
  •  时光取名叫无心
    2020-11-27 06:08

    Solution : Hi, I was developing a WP8 App and i needed multiple sounds to play simultaneously, the solutions mentioned above didnt work for me, So i used the XNA framwork. here is the link

    http://msdn.microsoft.com/en-us/library/ff842408.aspx

    and then play ur sound files like this...

    SoundEffect Sound = SoundEffect.FromStream(Application.GetResourceStream(new Uri("Assets/Sounds/wav/sound.wav", UriKind.Relative)).Stream);
    Sound.Play();
    

    For looping...

    SoundEffectInstance Sound = SoundEffect.FromStream(Application.GetResourceStream(new Uri("Assets/Sounds/wav/sound.wav", UriKind.Relative)).Stream).CreateInstance();
    Sound.IsLooped = true;
    Sound.Play();
    

    Note: the files must be in ".wav" (PCM, 8 or 16-bit, 8KHz to 48KHz, mono or stereo) format

提交回复
热议问题