public static void WmaToMp3(Stream wmafileStream, string outputPath, Mp3WriterConfig mp3Format, int bufferMultiplier) { using(var outputStream = new FileStream(outputPath, FileMode.Create)) { WmaToMp3(wmafileStream, outputStream, mp3Format, bufferMultiplier); } }
public static void WmaToMp3(string wmafilePath, Stream outputStream, Mp3WriterConfig mp3Format) { using(var inputStream = File.OpenRead(wmafilePath)) { WmaToMp3(inputStream, outputStream, mp3Format, 1); } }
public static void WmaToMp3(Stream wmaInputStream, Stream outputStream, Mp3WriterConfig mp3Format, int bufferMultiplier) { WmaToMp3Delegate convert = wmaStream => { var writer = new Mp3Writer(outputStream, mp3Format ?? new Mp3WriterConfig(wmaStream.Format, new BE_CONFIG(wmaStream.Format))); var buffer = new byte[writer.OptimalBufferSize*bufferMultiplier]; WriteToStream(writer, wmaStream, buffer); }; var tempStream = wmaInputStream as WmaStreamReader; if (tempStream != null) { convert(tempStream); } else { using (var wmaStream = new WmaStreamReader(wmaInputStream)) { convert(wmaStream); } } }
private void buttonInFile_Click(object sender, System.EventArgs e) { if (openFileDialog1.ShowDialog(this) == DialogResult.OK) { try { WaveStream s = new WaveStream(openFileDialog1.FileName); try { m_Config = new Mp3WriterConfig(s.Format); textBoxInFile.Text = openFileDialog1.FileName; textBoxOutFile.Text = System.IO.Path.ChangeExtension(textBoxInFile.Text, ".mp3"); } finally { s.Close(); } } catch { MessageBox.Show(this, "Invalid wave file or format", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBoxInFile.Text = ""; textBoxOutFile.Text = ""; } } }
private void buttonConfig_Click(object sender, System.EventArgs e) { Config cfg = new Config(); if (m_Config != null) { cfg.Mp3Config = m_Config; } if (cfg.ShowDialog(this) == DialogResult.OK) { m_Config = cfg.Mp3Config; } }
/// <summary> /// Create a Mp3Writer with specific MP3 format /// </summary> /// <param name="output">Stream that will hold the MP3 resulting data</param> /// <param name="cfg">Writer Config</param> public Mp3Writer(Stream output, Mp3WriterConfig cfg) : this(output, cfg.Format, cfg.Mp3Config) { }
public static void WmaToMp3(Stream wmafileStream, Stream outputStream, Mp3WriterConfig mp3Format) { WmaToMp3(wmafileStream, outputStream, mp3Format, 1); }
public static void WmaToMp3(Stream wmafileStream, string outputPath, Mp3WriterConfig mp3Format) { WmaToMp3(wmafileStream, outputPath, mp3Format, 1); }
public static void WmaToMp3(string wmafilePath, string outputPath, Mp3WriterConfig mp3Format) { WmaToMp3(wmafilePath, outputPath, mp3Format, 1); }