Exemple #1
0
 private LameWrapper GetLameWrapper()
 {
     Lame_WP8.LameWrapper mp3coder = new Lame_WP8.LameWrapper();
     mp3coder.EncodeBrate   = 128;
     mp3coder.EncodeQuality = LameContent.Quality_Well;
     return(mp3coder);
 }
Exemple #2
0
        private async void Button_WavFilePlay_Click(object sender, RoutedEventArgs e)
        {
            String sourceFile = "\\Assets\\xyy.mp3";
            String targetFile = "\\xyy.wav";

            try
            {
                Lame_WP8.LameWrapper mp3coder = GetLameWrapper();

                await mp3coder.DecodeMp3(m_InstallPath + sourceFile, m_LocalPath + targetFile);
            }
            catch (Exception ex)
            {
                String d = ex.Message;
            }


            using (FileStream stream = File.Open(m_LocalPath + targetFile, FileMode.Open))
            {
                byte[] res = new byte[stream.Length];
                stream.Read(res, 0, res.Length);
                SoundEffect soudplay = new SoundEffect(res, 44100, AudioChannels.Stereo);
                stream.Close();
                soudplay.Play();
            }
        }
Exemple #3
0
        private Task <CompressedContent> Mp3ToWave(IBuffer p_WaveData)
        {
            Lame_WP8.LameWrapper mp3coder = new Lame_WP8.LameWrapper();
            //mp3coder.Brate = 128;
            //mp3coder.InSampleRate = 0;
            //mp3coder.Mode = LameContent.Mode_STEREO;
            // mp3coder.NumChannels = 2;
            //mp3coder.Quality = LameContent.Quality_Well;

            return(new Lame_WP8.LameWrapper().DecodeMp3(p_WaveData).AsTask());
        }
Exemple #4
0
        private async void Button_Mp3FilePlay_Click(object sender, RoutedEventArgs e)
        {
            String sourceFile = "\\Assets\\xyy.wav";
            String targetFile = "\\xyy.mp3";

            try
            {
                Lame_WP8.LameWrapper mp3coder = GetLameWrapper();

                await mp3coder.EncodeMp3(m_InstallPath + sourceFile, m_LocalPath + targetFile);
            }
            catch (Exception ex)
            {
                String d = ex.Message;
            }
            using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(targetFile, FileMode.Open, IsolatedStorageFile.GetUserStoreForApplication()))
            {
                mediaElement.SetSource(stream);
                mediaElement.Position = new TimeSpan(0);
                mediaElement.Play();
            }
        }
Exemple #5
0
        private Task <CompressedContent> WaveToMp3(IBuffer p_WaveData)
        {
            Lame_WP8.LameWrapper mp3coder = GetLameWrapper();

            return(mp3coder.EncodeMp3(p_WaveData).AsTask());
        }
Exemple #6
0
        private Task<CompressedContent> Mp3ToWave(IBuffer p_WaveData)
        {
            Lame_WP8.LameWrapper mp3coder = new Lame_WP8.LameWrapper();
            //mp3coder.Brate = 128;
            //mp3coder.InSampleRate = 0;
            //mp3coder.Mode = LameContent.Mode_STEREO;
            // mp3coder.NumChannels = 2;
            //mp3coder.Quality = LameContent.Quality_Well;

            return new Lame_WP8.LameWrapper().DecodeMp3(p_WaveData).AsTask();
        }
Exemple #7
0
 private LameWrapper GetLameWrapper()
 {
     Lame_WP8.LameWrapper mp3coder = new Lame_WP8.LameWrapper();
     mp3coder.EncodeBrate = 128;
     mp3coder.EncodeQuality = LameContent.Quality_Well;
     return mp3coder;
 }