2010-07-20 6 views

답변

1

작동하지 않습니다. 코드에서

:

using Microsoft.Xna.Framework; 
using Microsoft.Xna.Framework.Audio; 

var stream = TitleContainer.OpenStream("beep.wav"); 
       var effect = SoundEffect.FromStream(stream); 
       effect.Play(); 

N.B. "beep.wav"는 "컨텐츠"로 구성되어야합니다. 응용 프로그램 생성자에서

추가 :

this.ApplicationLifetimeObjects.Add(new XNAAsyncDispatcher(TimeSpan.FromMilliseconds(50))); 

은 또한 다음과 같은 클래스를 추가 :

public class XNAAsyncDispatcher : IApplicationService 
{ 
    private DispatcherTimer frameworkDispatcherTimer; 

    public XNAAsyncDispatcher(TimeSpan dispatchInterval) 
    { 
     this.frameworkDispatcherTimer = new DispatcherTimer(); 
     this.frameworkDispatcherTimer.Tick += new EventHandler(frameworkDispatcherTimer_Tick); 
     this.frameworkDispatcherTimer.Interval = dispatchInterval; 
    } 

    void IApplicationService.StartService(ApplicationServiceContext context) { this.frameworkDispatcherTimer.Start(); } 
    void IApplicationService.StopService() { this.frameworkDispatcherTimer.Stop(); } 
    void frameworkDispatcherTimer_Tick(object sender, EventArgs e) { FrameworkDispatcher.Update(); } 
} 
관련 문제