2012-02-16 4 views
1

.wav 음악 파일이 있습니다. SoundEffect.Play()를 사용하여 재생하려고했을 때;소리 창을 재생할 때 소리가 들림 전화기 7 에뮬레이터

mus1.Play(); 나는 음악보다는 소음을 얻고있다. PC 뮤직 플레이어에서도 마찬가지입니다. 이 문제를 해결하는 방법?

Windows Phone 7에서도 제대로 재생되는지 확인하는 방법은 무엇입니까?

+0

어떤 코드를 게시하여 알려주십시오. – abhinav

+1

Francly, 에뮬레이터에서 문제가되는 것 같습니다 ... 앱을 테스트하고 문제가 무엇인지 확인할 수있는 사람을 얻을 수 없습니까? 원한다면 인터넷을 통해 샘플 XAP을 게시 할 수 있습니다. 나 또는 다른 개발자가 문제를 phisical 장치에서 지속하는지 테스트하고 확인하는 데 도움이됩니다. –

답변

0

WP7에서 이해할 수없는 .wav 파일의 내용이있는 것 같습니다. 왜 .wav로 변환하려고 시도합니까 (예 .wav에 이미 있음을 알고 있습니다). 알 수없는 데이터가 제거 될 수 있습니다.

Audacity (http://audacity.sourceforge.net/)는 무료이며이를 수행 할 것입니다. .wav 파일을 파일로 드래그하고 파일 -> 내보내기를 클릭하십시오.

+0

이전 게시물을 다시 열어서 미안하지만 같은 일을하고 있습니다. Audacity로 .WAV로 간단하게 변경해도 문제가 해결되지 않습니다. 도움을 주시겠습니까? http://stackoverflow.com/questions/13157992/audio-distored-and-incomprehensible-using-windows-phone-mediaelement (실제 기기에서는 음성 대신에 왜곡이납니다) – GONeale

0

당신이 할 수있는, enter image description here

처럼 다음 코드

MainPage.xaml.cs를

namespace MediaSample 
{ 
    public partial class MainPage : PhoneApplicationPage 
    { 
     // Constructor 
     public MainPage() 
     { 
      InitializeComponent(); 
      progress.DataContext = this; 
      this.Loaded += new System.Windows.RoutedEventHandler(MainPage_Loaded); 
      mediaplayer.BufferingProgressChanged += new System.Windows.RoutedEventHandler(mediaplayer_BufferingProgressChanged); 
      mediaplayer.CurrentStateChanged += new RoutedEventHandler(mediaplayer_CurrentStateChanged); 
     } 

     public double Duration { get; set; } 

     void mediaplayer_CurrentStateChanged(object sender, RoutedEventArgs e) 
     { 
      if (mediaplayer.CurrentState == MediaElementState.Playing) 
      { 
       Duration = mediaplayer.NaturalDuration.TimeSpan.TotalSeconds; 
       ThreadPool.QueueUserWorkItem(o => 
       { 
        while (true) 
        { 
         Dispatcher.BeginInvoke(new Action(() => Progress = mediaplayer.Position.TotalSeconds * 100/Duration)); 
         Thread.Sleep(0); 
        } 
       }); 
      } 
     } 

     void mediaplayer_BufferingProgressChanged(object sender, System.Windows.RoutedEventArgs e) 
     { 
      MediaElement mediaplayer = sender as MediaElement; 
      if (mediaplayer.BufferingProgress == 1) 
       Debug.WriteLine(mediaplayer.NaturalDuration); 
     } 

     void MainPage_Loaded(object sender, System.Windows.RoutedEventArgs e) 
     { 
      mediaplayer.Source = new Uri("/Oru nalum..mp3", UriKind.Relative); 
      mediaplayer.Play(); 
     } 



     public double Progress 
     { 
      get { return (double)GetValue(ProgressProperty); } 
      set { SetValue(ProgressProperty, value); } 
     } 

     // Using a DependencyProperty as the backing store for Progress. This enables animation, styling, binding, etc... 
     public static readonly DependencyProperty ProgressProperty = 
      DependencyProperty.Register("Progress", typeof(double), typeof(PhoneApplicationPage), new PropertyMetadata(0.0)); 



    } 
} 

에서 MainPage.xaml

<phone:PhoneApplicationPage 
    x:Class="MediaSample.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" 
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" 
    FontFamily="{StaticResource PhoneFontFamilyNormal}" 
    FontSize="{StaticResource PhoneFontSizeNormal}" 
    Foreground="{StaticResource PhoneForegroundBrush}" 
    SupportedOrientations="Portrait" Orientation="Portrait" 
    shell:SystemTray.IsVisible="True"> 

    <Grid x:Name="LayoutRoot" Background="Transparent"> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="Auto"/> 
      <RowDefinition Height="*"/> 
     </Grid.RowDefinitions> 

     <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"> 
      <TextBlock x:Name="ApplicationTitle" Text="Media Application" Style="{StaticResource PhoneTextNormalStyle}"/> 
     </StackPanel>   

     <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> 
      <MediaElement x:Name="mediaplayer"/> 
      <ProgressBar Height="40" x:Name="progress" Value="{Binding Path=Progress}"/> 
     </Grid> 
    </Grid> 


</phone:PhoneApplicationPage> 

다음과 같이 MP3 파일을 추가 시도 .wav 파일을 추가하십시오. 잘 작동합니다. 위의 테스트 코드. 감사합니다.

0

SoundEffect 클래스를 사용하는 대신 MeadiaElement를 사용하십시오. 이것을 시도하십시오 MediaElement

관련 문제