This project has moved and is read-only. For the latest updates, please go here.

AcmNotPossible calling acmStreamOpen

Nov 18, 2014 at 12:55 PM
    OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.InitialDirectory = "C:\\Users\\jack_sparrow_000\\OneDrive\\Documents";
            openFileDialog1.Filter = "wav files (*.wav)|*.wav";
            openFileDialog1.FilterIndex = 2;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    if (openFileDialog1.OpenFile() != null)
                    {
                        using (var reader = new NAudio.Wave.WaveFileReader(openFileDialog1.OpenFile()))
                        {
                            var newFormat = new NAudio.Wave.WaveFormat(44100, 16);

                            var strtemp = new NAudio.Wave.WaveFormatConversionStream(new NAudio.Wave.WaveFormat(newFormat.SampleRate,reader.WaveFormat.BitsPerSample), NAudio.Wave.WaveFormatConversionStream.CreatePcmStream(reader)); //This line causes error
                           var str = new NAudio.Wave. WaveFormatConversionStream(newFormat, strtemp);
                            try
                            {
                                NAudio.Wave.WaveFileWriter.CreateWaveFile("temp.wav", str);
                            }
                            catch (Exception ex)
                            {
                                System.Windows.MessageBox.Show(String.Format("{0}", ex.Message));
                            }
                            finally
                            {
                                str.Close();
                            }
                            var temp = new NAudio.Wave.WaveFileReader("temp.wav");
                            wavFile = NAudio.Wave.WaveFormatConversionStream.CreatePcmStream(temp);


                        }
                        Success.Text = "Loaded wav file";
                    }
                    else
                    {
                        Success.Text = "Error Loading wav file";
                    }
                }
                catch (Exception ex)
                {
                    Success.Text = "Error Loading wav file catch clause";
                }
            }
Any ideas on how to fix this?
Nov 18, 2014 at 2:51 PM
I think you have the wrong project... Try posting in the NAudio project.
Marked as answer by zoomvirus on 12/2/2014 at 5:06 AM
Nov 19, 2014 at 8:46 AM
Thank you sorry I never noticed I was on the wrong project.