mazzica1 / practicesharp

Automatically exported from code.google.com/p/practicesharp
0 stars 0 forks source link

Problem with Skip() command when using WMAFileReader. #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I am building an app with NAudio and was playing around with WMAFileReader(). 
It plays WMA files great but I am having an issue when using the skip() method. 
My app works great works perfectly with .mp3 and .wav. 
I should be using the latest dll. It's the one form your latest practice# app.

for me the seek() method is working great.

I didn't know if this was an issue you were aware of.

Below is the error I am getting.

System.InvalidCastException was unhandled by user code
  Message=Unable to cast COM object of type 'System.__ComObject' to interface type 'NAudio.WindowsMediaFormat.IWMSyncReader'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{9397F121-7705-4DC9-B049-98B698188414}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
  Source=mscorlib
  StackTrace:
       at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, Boolean& pfNeedsRelease)
       at NAudio.WindowsMediaFormat.IWMSyncReader.SetRange(UInt64 cnsStartTime, Int64 cnsDuration)
       at NAudio.WindowsMediaFormat.WmaStream.Seek(Int64 offset, SeekOrigin origin)
       at NAudio.WindowsMediaFormat.WmaStream.set_Position(Int64 value)
       at NAudio.WindowsMediaFormat.WMAFileReader.set_Position(Int64 value)
       at NAudio.Wave.WaveStream.Skip(Int32 seconds)

Original issue reported on code.google.com by mccords...@gmail.com on 8 Dec 2011 at 9:56

GoogleCodeExporter commented 8 years ago
First, the WMA code moved into NAudio. I suggest using the latest version of 
NAudio (currently 1.5.4), not the source code in PracticeSharp. NAudio now has 
my original code embedded into it.

Secondly, could you please post a small test console application that 
replicates your problem and an audio file that triggers that error?

And lastly, looking at the code and your stack trace, it seems the actual issue 
comes from IWMSyncReader.SetRange(),not from WaveStream.Skip().
The MSDN page for SetRange specifies this requirement: 
"Version - Windows Media Format 9 Series SDK, or later"
http://msdn.microsoft.com/en-us/library/windows/desktop/dd798704(v=VS.85).aspx

I wonder what Windows Media version in installed on your operating system 
(which Widnows is it?)?

Original comment by yuva...@gmail.com on 22 Dec 2011 at 3:54

GoogleCodeExporter commented 8 years ago
No feedback from user.
Issue is probably due to and old Windows Media version/old operating system.

To ensure full playback of WMA, please make sure Media Player 9 or above is 
installed.
If you're not sure what version you have, please follow the Microsoft KB 190990.
http://support.microsoft.com/kb/190990

1. Note that this issue only affects WMA - other file formats are not using the 
Windows Media API.
2. (Even though I wrote the original WMA playback code) It is a problem with 
NAudio, but affects Practice#. All other clients applications using NAudio 
should experience a similar problem. I will report it to NAudio's author, 
perhaps a Media Player version check is needed.

Original comment by yuva...@gmail.com on 28 Dec 2011 at 1:39