0
我需要知道如何在一個文件保存聲音流中的飛行記錄.NET麥克風錄音保存在windows手機文件8
後,這是我的代碼,我需要保存一個外部文件WAV或不適合。
所以在這一點上這裏有錄音鍵播放按鈕和遊戲對象
private void recordButton_Click(object sender, EventArgs e)
{
// Get audio data in 1/2 second chunks
microphone.BufferDuration = TimeSpan.FromMilliseconds(500);
// Allocate memory to hold the audio data
buffer = new byte[microphone.GetSampleSizeInBytes(microphone.BufferDuration)];
// Set the stream back to zero in case there is already something in it
stream.SetLength(0);
// Start recording
microphone.Start();
SetButtonStates(false, false, true);
UserHelp.Text = "recording";
// StatusImage.Source = microphoneImage;
}
private void playButton_Click(object sender, EventArgs e)
{
if (stream.Length > 0)
{
// Update the UI to reflect that
// sound is playing
SetButtonStates(false, false, true);
UserHelp.Text = "play";
// Play the audio in a new thread so the UI can update.
Thread soundThread = new Thread(new ThreadStart(playSound));
soundThread.Start();
}
}
private void playSound()
{
// Play audio using SoundEffectInstance so we can monitor it's State
// and update the UI in the dt_Tick handler when it is done playing.
SoundEffect sound = new SoundEffect(stream.ToArray(), microphone.SampleRate, AudioChannels.Mono);
soundInstance = sound.CreateInstance();
soundIsPlaying = true;
soundInstance.Play();
}
看到這個http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj681698(v=vs.105).aspx – Aybe
不是這個.... – user3529738