When I using ResamplerDmoStream and selecting Anything except WaveOutput (e.g. WASAPI, DirectSound) I've getting below exception:
Unable to cast COM Object NAudio.DMO.ResamplerMediaComObject to interface type Naudio.Dmo.IMediaObject ...
Exception Call stack:
at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
at NAudio.Dmo.IMediaObject.GetInputStatus(Int32 inputStreamIndex, DmoInputStatusFlags& flags)
at NAudio.Dmo.MediaObject.IsAcceptingData(Int32 inputStreamIndex) in NAudio\Dmo\MediaObject.cs:line 468
at NAudio.Wave.ResamplerDmoStream.Read(Byte[] buffer, Int32 offset, Int32 count) in NAudio\Wave\WaveStreams\ResamplerDmoStream.cs:line 136
at NAudio.Wave.Wave16ToFloatProvider.Read(Byte[] destBuffer, Int32 offset, Int32 numBytes) in NAudio\Wave\WaveProviders\Wave16toFloatProvider.cs:line 47
at NAudio.Wave.MixingWaveProvider32.Read(Byte[] buffer, Int32 offset, Int32 count) in NAudio\Wave\WaveProviders\MixingWaveProvider32.cs:line 116
at NAudio.Wave.SampleProviders.WaveToSampleProvider.Read(Single[] buffer, Int32 offset, Int32 count) in NAudio\Wave\SampleProviders\WaveToSampleProvider.cs:line 33
at NAudio.Wave.SampleProviders.MeteringSampleProvider.Read(Single[] buffer, Int32 offset, Int32 count) in NAudio\Wave\SampleProviders\MeteringSampleProvider.cs:line 72
at NAudio.Wave.SampleProviders.VolumeSampleProvider.Read(Single[] buffer, Int32 offset, Int32 sampleCount) in NAudio\Wave\SampleProviders\VolumeSampleProvider.cs:line 42
at NAudio.Wave.SampleProviders.SampleChannel.Read(Single[] buffer, Int32 offset, Int32 sampleCount) in NAudio\Wave\SampleProviders\SampleChannel.cs:line 58
at NAudio.Wave.SampleProviders.MeteringSampleProvider.Read(Single[] buffer, Int32 offset, Int32 count) in NAudio\Wave\SampleProviders\MeteringSampleProvider.cs:line 72
at NAudio.Wave.SampleProviders.MultiplexingSampleProvider.Read(Single[] buffer, Int32 offset, Int32 count) in NAudio\Wave\SampleProviders\MultiplexingSampleProvider.cs:line 93
at NAudio.Wave.SampleProviders.SampleToWaveProvider.Read(Byte[] buffer, Int32 offset, Int32 count) in NAudio\Wave\SampleProviders\SampleToWaveProvider.cs:line 35
at NAudio.Wave.DirectSoundOut.Feed(Int32 bytesToCopy) in NAudio\Wave\WaveOutputs\DirectSoundOut.cs:line 516
at NAudio.Wave.DirectSoundOut.PlaybackThreadFunc() in NAudio\Wave\WaveOutputs\DirectSoundOut.cs:line 415
The problem is very likely that you are creating COM objects (in this case the DMO Resampler) on a STAThread (which will be the case if you are using WinForms or WPF) and then passing them to NAudio output driver models that will attempt to access them on a background thread, which is not allowed.
It is a very annoying problem to work around, since if you set your GUI thread to be MTAThread, other stuff will break (e.g. open file dialogs). Your main options are as follows:
Stick with using WaveOut which has windowed callbacks. You will also be able to use WasapiOutGuiThread, which is an experimental class I added to the demo project recently. This is by far the easiest solution. Is there any reason you really need to use DirectSound?
Don't have a ResamplerDmoStream in your audio pipeline. Use WaveFormatConversionStream instead, or simply let WASAPI insert one (which it does automatically)
Create a background thread which will be used for your audio playback, and send messages from your GUI thread to it, telling it you want to start, stop, reposition etc. This unfortunately is a fairly complicated option.
Related
I think I am having a problem with my sql database. I have an application that is all of a sudden throwing an access violation error when ever the tableadapter is filled.
I believe that something may have happened to the database in general because if I pull up an earlier version of the program code, I get the same errors.
This is the line that it fails during
URTableAdapter.Fill(URDataSet.UR)
This is the Exception error text:
Exception thrown: 'System.Data.ConstraintException' in System.Data.dll
System.Transactions Critical: 0 : xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" >Severity="Critical"
TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/200>4/07/Reliability/Exception/UnhandledUnhandled >exceptionUR.vshost.exe>>
System.Data.ConstraintException, System.Data, Version=4.0.0.0, >Culture=neutral, PublicKeyToken=b77a5c561934e089Failed >to enable constraints. One or more rows contain values violating non-null, >unique, or foreign-key constraints. at >System.Data.DataSet.EnableConstraints()
at System.Data.DataSet.set_EnforceConstraints(Boolean value)
at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader >dataReader, Int32 startRecord, Int32 maxRecords)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, >DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, >IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 >startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at UR.URDataSetTableAdapters.URTableAdapter.Fill(URDataTable dataTable) in >H:\Databases\UR\UREvolv\UR\URDataSet.Designer.vb:line 10650
at UR.DataEntry.LOCCB_SelectedIndexChanged(Object sender, EventArgs e) in >H:\Databases\UR\UREvolv\UR\DataEntry.vb:line 2103
at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
at System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)
at System.Windows.Forms.ComboBox.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 >msg, IntPtr wparam, IntPtr lparam)>System.Data.ConstraintException: Failed to enable constraints. >One or more rows contain values violating non-null, unique, or foreign-key >constraints.
at System.Data.DataSet.EnableConstraints()
at System.Data.DataSet.set_EnforceConstraints(Boolean value)
at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader >dataReader, Int32 startRecord, Int32 maxRecords)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, >DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, >IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 >startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at UR.URDataSetTableAdapters.URTableAdapter.Fill(URDataTable dataTable) in >H:\Databases\UR\UREvolv\UR\URDataSet.Designer.vb:line 10650
at UR.DataEntry.LOCCB_SelectedIndexChanged(Object sender, EventArgs e) in >H:\Databases\UR\UREvolv\UR\DataEntry.vb:line 2103
at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
at System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)
at System.Windows.Forms.ComboBox.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 >msg, IntPtr wparam, IntPtr lparam)
The program '[13508] UR.vshost.exe' has exited with code -1073741819 >(0xc0000005) 'Access violation'.
Thank you for any help you may be able to give,
Steve
I am still not sure what happened to the original exe and DB, but I was able to restore an older copy of the program with a current backup of the DB and make the changes since previous version.
Thank you,
Steve
I have some problem with VS2015: when I open any project and try to open a file for editing - VS2015 crashes. I try reinstall, all /commands and more.
ActivityLog.xml:
<entry>
<record>430</record>
<time>2015/11/03 14:46:35.669</time>
<type>Error</type>
<source>Editor or Editor Extension</source>
<description>System.IO.FileFormatException: Input file or data stream does not conform to the expected file format specification. ---> System.IO.FileFormatException: Input file or data stream does not conform to the expected file format specification.
at MS.Internal.Text.TextInterface.Native.Util.ConvertHresultToException(Int32 hr)
at MS.Internal.Text.TextInterface.Font.CreateFontFace()
at MS.Internal.Text.TextInterface.Font.AddFontFaceToCache()
at MS.Internal.Text.TextInterface.Font.GetFontFace()
at System.Windows.Media.GlyphTypeface..ctor(Font font)
at MS.Internal.FontFace.PhysicalFontFamily.GetGlyphTypeface(FontStyle style, FontWeight weight, FontStretch stretch)
at MS.Internal.FontFace.PhysicalFontFamily.MS.Internal.FontFace.IFontFamily.GetTypefaceMetrics(FontStyle style, FontWeight weight, FontStretch stretch)
at System.Windows.Media.Typeface.ConstructCachedTypeface()
at System.Windows.Media.Typeface.get_CachedTypeface()
at System.Windows.Media.Typeface.get_Symbol()
at MS.Internal.TextFormatting.TextStore.FetchTextRun(Int32 cpFetch)
at MS.Internal.TextFormatting.TextStore.FetchLSRun(Int32 lscpFetch, TextFormattingMode textFormattingMode, Boolean isSideways, Plsrun& plsrun, Int32& lsrunOffset, Int32& lsrunLength)
at MS.Internal.TextFormatting.LineServicesCallbacks.FetchRunRedefined(IntPtr pols, Int32 lscpFetch, Int32 fIsStyle, IntPtr pstyle, Char* pwchTextBuffer, Int32 cchTextBuffer, Int32& fIsBufferUsed, Char*& pwchText, Int32& cchText, Int32& fIsHidden, LsChp& lschp, IntPtr& lsplsrun)
--- End of inner exception stack trace ---
at MS.Internal.TextFormatting.TextMetrics.FullTextLine.FormatLine(FullTextState fullText, Int32 cpFirst, Int32 lineLength, Int32 formatWidth, Int32 finiteFormatWidth, Int32 paragraphWidth, LineFlags lineFlags, FormattedTextSymbols collapsingSymbol)
at MS.Internal.TextFormatting.TextFormatterImp.FormatLineInternal(TextSource textSource, Int32 firstCharIndex, Int32 lineLength, Double paragraphWidth, TextParagraphProperties paragraphProperties, TextLineBreak previousLineBreak, TextRunCache textRunCache)
at MS.Internal.TextFormatting.TextFormatterImp.FormatLine(TextSource textSource, Int32 firstCharIndex, Double paragraphWidth, TextParagraphProperties paragraphProperties, TextLineBreak previousLineBreak)
at System.Windows.Media.FormattedText.LineEnumerator.FormatLine(TextSource textSource, Int32 textSourcePosition, Double maxLineLength, TextParagraphProperties paraProps, TextLineBreak lineBreak)
at System.Windows.Media.FormattedText.LineEnumerator.MoveNext()
at System.Windows.Media.FormattedText.DrawAndCalculateMetrics(DrawingContext dc, Point drawingOffset, Boolean getBlackBoxMetrics)
at System.Windows.Media.FormattedText.get_Metrics()
at Microsoft.VisualStudio.Language.Intellisense.Implementation.CodeLensInterLineAdornmentTaggerProvider.TextFormatCache.UpdateTextHeight()
at Microsoft.VisualStudio.Language.Intellisense.Implementation.CodeLensInterLineAdornmentTaggerProvider.TextFormatCache.EnsureInitialized()
at Microsoft.VisualStudio.Language.Intellisense.Implementation.CodeLensInterLineAdornmentTaggerProvider.CodeLensInterLineAdornmentTagger.GetTags(NormalizedSnapshotSpanCollection spans)
at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.<GetTagsForBuffer>d__38.MoveNext()</description>
</entry>
I found a problem. CodeLens broken. If I turn it off, then it works. How i can fix CodeLens? a problem in the font (ActivityLog.txt show some methods with font)?
I fixed a CodeLens. I started checking the registry errors by CCleaner and fix all mistakes.
I encountered a similar problem.Use wpf program, if you install an illegal font, use the font error, when we select font using the property box,every font will be used, so an error occurs.
I found the problem in the environment:
win7 32(x86)
.net4.5
wpf
Hope someone can completely solve.
there is an MVC4 application on IIS7 Windows2008 machine. the application runs as ApplicationPoolIdentity and the appropriate user has access to the ProgramData\IsolatedStorage folder.
it has also permission on the C:\Documents and Settings\Default User\Local Settings\Application Data\IsolatedStorage folder as well.
but still receive exception while writing big excel files with openxml.
ERROR MHDB.MvcApplication - System.ObjectDisposedException: Store must be open for this operation.
at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, IsolatedStorageFile isf)
at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, IsolatedStorageFile isf)
at MS.Internal.IO.Packaging.PackagingUtilities.SafeIsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, ReliableIsolatedStorageFileFolder folder)
at MS.Internal.IO.Packaging.PackagingUtilities.CreateUserScopedIsolatedStorageFileStreamWithRandomName(Int32 retryCount, String& fileName)
at MS.Internal.IO.Packaging.SparseMemoryStream.EnsureIsolatedStoreStream()
at MS.Internal.IO.Packaging.SparseMemoryStream.SwitchModeIfNecessary()
at MS.Internal.IO.Packaging.CompressEmulationStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at MS.Internal.IO.Packaging.CompressStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.Xml.XmlUtf8RawTextWriter.FlushBuffer()
at System.Xml.XmlUtf8RawTextWriter.RawText(Char* pSrcBegin, Char* pSrcEnd)
at System.Xml.XmlUtf8RawTextWriter.WriteEndElement(String prefix, String localName, String ns)
at System.Xml.XmlWellFormedWriter.WriteEndElement()
at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w)
at DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter)
at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w)
at DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter)
at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w)
at DocumentFormat.OpenXml.OpenXmlPartRootElement.WriteTo(XmlWriter xmlWriter)
at DocumentFormat.OpenXml.OpenXmlPartRootElement.SaveToPart(OpenXmlPart openXmlPart)
at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.SavePartContents()
at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose(Boolean disposing)
at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose()
at BL.OpenXML.Export(DataTable dt, Stream fs, Boolean createNewDocument)
at BL.BusinessLogic.CreateOpReport(UnitOfWork uow, String user, String orgapath, List`1 orgaids, Boolean isfin, String cycle, String startperiod, String endperiod)
at MHDB.Controllers.HomeController.GetFileAsStream()
at MHDB.Controllers.HomeController.ExportExcel()
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<InvokeActionMethodWithFilters>b__10()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
thanks for any help!
Due to the System.IO.Packaging when you write files larger than 10MB internally it will no longer hold the data temporarily in memory until next save but will switch over to Isolated Storage. That on its own can cause a lot of problems because IsolateStorage is not meant to be used with multiple thread/multiple instances of the same application and you could be facing some permission issues with this as well.
Considering that this is a web app I think it may relate to multiple user writing at same time but all being resolved to the same Isolated Storage location..
I have stumbled upon this problem with multiple instances of same app all being resolved to same location. I am still looking for an elegant solution but I was able to force each instance to be resolved to a different IsolatedStorage location and be unique by using this:
var rootDirUserField= typeof(IsolatedStorageFile).GetField("s_RootDirUser", BindingFlags.NonPublic | BindingFlags.Static);
rootDirUserField.SetValue(null, "<unique location in isolated storage>");
This works because the static field IsolatedStorageFile.s_RootDirUser is used in resolving a new directory to use. My fix was specific to the User | Domain | Assembly scope.
I am keen to get a better solution to fix this problem.
I have just starting my excel interop code to epplus and did it when savng an excel document but I can't read an existing file. I searched but every result is related with web applications, I am developing a desktop application.
My code is so simple:
Dim File As FileInfo = New FileInfo(DosyaAd)
Using package As New ExcelPackage(File)
Dim She As ExcelWorksheet
She = package.Workbook.Worksheets("BF")
End using
I got this error at: She = package.Workbook.Worksheets("BF")
System.IO.IsolatedStorage.IsolatedStorageException was unhandled by user code
HResult=-2146233264
Message=Unable to determine the identity of domain.
Source=mscorlib
StackTrace:
at System.IO.IsolatedStorage.IsolatedStorage._GetAccountingInfo(Evidence evidence, Type evidenceType, IsolatedStorageScope fAssmDomApp, Object& oNormalized)
at System.IO.IsolatedStorage.IsolatedStorage.GetAccountingInfo(Evidence evidence, Type evidenceType, IsolatedStorageScope fAssmDomApp, String& typeName, String& instanceName)
at System.IO.IsolatedStorage.IsolatedStorage._InitStore(IsolatedStorageScope scope, Evidence domainEv, Type domainEvidenceType, Evidence assemEv, Type assemblyEvidenceType, Evidence appEv, Type appEvidenceType)
at System.IO.IsolatedStorage.IsolatedStorage.InitStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType)
at MS.Internal.IO.Packaging.PackagingUtilities.ReliableIsolatedStorageFileFolder.GetCurrentStore()
at MS.Internal.IO.Packaging.PackagingUtilities.ReliableIsolatedStorageFileFolder..ctor()
at MS.Internal.IO.Packaging.PackagingUtilities.GetDefaultIsolatedStorageFile()
at MS.Internal.IO.Packaging.PackagingUtilities.CreateUserScopedIsolatedStorageFileStreamWithRandomName(Int32 retryCount, String& fileName)
at MS.Internal.IO.Packaging.SparseMemoryStream.SwitchModeIfNecessary()
at MS.Internal.IO.Packaging.SparseMemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at MS.Internal.IO.Packaging.DeflateEmulationTransform.Decompress(Stream source, Stream sink)
at MS.Internal.IO.Packaging.CompressEmulationStream..ctor(Stream baseStream, Stream tempStream, Int64 position, IDeflateTransform transformer)
at MS.Internal.IO.Packaging.CompressStream.ChangeMode(Mode newMode)
at MS.Internal.IO.Packaging.CompressStream.Seek(Int64 offset, SeekOrigin origin)
at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Seek(Int64 offset, SeekOrigin origin)
at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.StreamReader.ReadBuffer(Char[] userBuffer, Int32 userOffset, Int32 desiredChars, Boolean& readToUserBuffer)
at System.IO.StreamReader.Read(Char[] buffer, Int32 index, Int32 count)
at System.IO.StreamReader.ReadBlock(Char[] buffer, Int32 index, Int32 count)
at OfficeOpenXml.ExcelWorksheet.GetWorkSheetXml(Stream stream, Int64 start, Int64 end, Encoding& encoding)
at OfficeOpenXml.ExcelWorksheet.CreateXml()
at OfficeOpenXml.ExcelWorksheet..ctor(XmlNamespaceManager ns, ExcelPackage excelPackage, String relID, Uri uriWorksheet, String sheetName, Int32 sheetID, Int32 positionID, eWorkSheetHidden hide)
at OfficeOpenXml.ExcelWorksheets..ctor(ExcelPackage pck, XmlNamespaceManager nsm, XmlNode topNode)
at OfficeOpenXml.ExcelWorkbook.get_Worksheets()
at OfficeOpenXml.ExcelWorkbook.GetDefinedNames()
at OfficeOpenXml.ExcelPackage.get_Workbook()
.........
If this workbook was generated in Microsoft Office or through the interop, the workbook may contain features that are not available through the EPPLus library, such as lines and themes, and others listed here.
I have not experienced it myself, but I have heard from others that issues come up when the Worksheet contains a lot of content.
I've got this code:
static void Main(string[] args)
{
try
{
Mp3FileReader reader = new Mp3FileReader(#"C:\testAudio.mp3");
long count = reader.Length;
if (count <= int.MaxValue)
{
byte[] info = new byte[count];
reader.Read(info, 0, (int)count);
Console.WriteLine("Succesfull read");
}
else
Console.WriteLine("Could not read");
}
catch(Exception ex)
{
Console.WriteLine(ex);
}
}
that prints out the following exception message:
System.ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds.
at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
at NAudio.Wave.AcmMp3FrameDecompressor.DecompressFrame(Mp3Frame frame, Byte[] dest, Int32 destOffset) in C:\NAudio-Source\NAudio\FileFormats\Mp3\Mp3FrameDecompressor.cs:line 50
at NAudio.Wave.Mp3FileReader.Read(Byte[] sampleBuffer, Int32 offset, Int32 numBytes) in C:\NAudio-Source\NAudio\Wave\WaveStreams\Mp3FileReader.cs:line 338
at Tester.Program.Main(String[] args) in C:\Tester\Program.cs:line 30
I've downloaded NAudio code and I've been debugging it but I can't find the cause of the error, although, as you can see on the stack trace is in NAudio-Source\NAudio\FileFormats\Mp3\Mp3FrameDecompressor.cs:line 50
Am I doing something wrong? By the way, it only happens with a few mp3 files, others are read just fine. I could send one conflicted file if needed.
-------------------------EDIT TO REFER TO THREAD ON NAUDIO CODEPLEX--------------------------------
See this issue on Codeplex Same question on Codeplex NAudio
Don't try to read the entire file in one hit. Instead, read around one seconds worth at a time and keep going until Read returns 0.