본문 바로가기

WindowPhone/XNA

오옷!!!!!! SoundEffect 로 음을 재생시 문제점!!(해결 방법) by gilbert

오옷~ 역시 이팀장님!! 해결 방법을 제시해 주셨습니다.

어제 문제의 소스

            byte[] resourceByte;

            StreamResourceInfo sri = App.GetResourceStream(new Uri("/SoundTest;component/Sound/Do.wav", UriKind.Relative));

            resourceByte = new byte[sri.Stream.Length];

            sri.Stream.Read(resourceByte, 0, (int)sri.Stream.Length);

 

            //요기가 다름

            SoundEffect effect = new Microsoft.Xna.Framework.Audio.SoundEffect(resourceByte,

                    44100, Microsoft.Xna.Framework.Audio.AudioChannels.Stereo);

            FrameworkDispatcher.Update();

            effect.Play();


 

 

수정된 소스

            byte[] resourceByte;

            StreamResourceInfo sri = App.GetResourceStream(new Uri("/SoundTest;component/Sound/Do.wav", UriKind.Relative));

            resourceByte = new byte[sri.Stream.Length];

            sri.Stream.Read(resourceByte, 0, (int)sri.Stream.Length);

 

            SoundEffect effect = new SoundEffect(resourceByte,

                100,

                resourceByte.Length - 100,

                44100, Microsoft.Xna.Framework.Audio.AudioChannels.Stereo,

                0,

                0);

            FrameworkDispatcher.Update();

            effect.Play();


 

결론 앞부분 100byte정도만 날려주면 틱 거리는 소리가 제거가 된다!!

이구용. 실제로 테스트 해보닌까 틱 소리가 제거 되었습니다 :-D 잇힝

 

오늘도 뿅~