2013-03-17 1 views
0

저는 XNa의 소리 관련 개체를 사용하여 사운드 보드가 될 Windows Phone 용 첫 번째 앱을 작성하고 있습니다.XNA를 사용하여 음향 효과 재생 시도

이 프로젝트는 내가 책에서 몇 가지 예제 코드, 101 전화 7 애플 리케이션을 가지고 #

c를 윈도우 폰 실버 라이트와 XNA 응용 프로그램입니다. 소리에로드 linbe는 "유형 StreamResourceInfo 네임 스페이스를 찾을 수 없습니다"나에게 제공

StreamResourceInfo 정보 = Application.GetResourceStream (새 열린 우리당 ("오디오/cowbell.wav", UriKind.Relative));

코드

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Net; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Documents; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Animation; 
using System.Windows.Shapes; 
using Microsoft.Phone.Controls; 
using Microsoft.Xna.Framework.Audio; 


namespace SlXnaApp4 
{ 
public partial class MainPage : PhoneApplicationPage 
{ 
    SoundEffect cowbell; 

    // Constructor 
    public MainPage() 
    { 
     // Load sound file 

     StreamResourceInfo info = Application.GetResourceStream(new Uri("Audio/cowbell.wav", UriKind.Relative)); 

     // create xna sound 
     cowbell = SoundEffect.FromStream(info); 

     // Sub to per frame call back 
     CompositionTarget.Rendering += CompositionTarget_Rendering; 

     // requred for xna sound effects to work 
     Microsoft.Xna.Framework.FrameworkDispatcher.Update(); 

     // testb sound 
     cowbell.Play(); 

     InitializeComponent(); 
    } 

    void CompositionTarget_Rendering(object sender, EventArgs e) 
    { 
     Microsoft.Xna.Framework.FrameworkDispatcher.Update(); 
    } 




    // Simple button Click event handler to take us to the second page 
    private void Button_Click(object sender, RoutedEventArgs e) 
    { 
     NavigationService.Navigate(new Uri("/GamePage.xaml", UriKind.Relative)); 
    } 

    private void button1_Click(object sender, RoutedEventArgs e) 
    { 

    } 
} 

}

+0

당신이 System.Windows''에 대한 참조를 추가 했습니까? – keyboardP

+0

'System.Windows'는 항상 기본값으로 참조됩니다. –

답변

관련 문제