This project has moved. For the latest updates, please go here.

AcmNotPossible calling acmStreamOpen

Dec 23, 2012 at 5:55 AM
Edited Dec 23, 2012 at 6:14 AM

Hello community,

With the following piece of code:

         LoopStream inputStream;
            if (fileName.EndsWith(".mp3" ))
            {
                var mp3Reader = new Mp3FileReader(fileName);
                inputStream = new LoopStream(mp3Reader);
            }

 A friend of mine is receiving the error " AcmNotPossible calling acmStreamOpen"

 The stack trace looks something like this:

   at NAudio.Wave.AcmMp3FrameDecompressor..ctor(WaveFormat sourceFormat)   at NAudio.Wave.Mp3FileReader.CreateAcmFrameDecompressor(WaveFormat mp3Format)   at NAudio.Wave.Mp3FileReader..ctor(Stream inputStream, FrameDecompressorBuilder frameDecompressorBuilder)   at NAudio.Wave.Mp3FileReader..ctor(Stream inputStream)   at NAudio.Wave.Mp3FileReader..ctor(String mp3FileName)   at Dream.World.AssetManager.CreateInputStream(String fileName)

Does anyone have any ideas? 

Coordinator
Dec 23, 2012 at 6:44 AM

It means you don't have an ACM codec installed that can decompress MP3. What operating system are you running on?

Dec 23, 2012 at 2:17 PM

Hi, I also seem to run into this problem running the NAudio Demo on Windows 8 when I set the target framework to be 4.0 or 4.5. If I set the target framework to be 3.5, it works fine. I did not have this problem under Windows 7 even with .Net 4.0.

I haven't found a way around this and am quite stuck right now. Hope this helps!

Coordinator
Dec 23, 2012 at 2:24 PM

in the NAudio demo app, can you go to the ACM codec tab and see what codecs you have installed. Also are you running 32 bit or 64 bit (the executable, not your OS)

Dec 23, 2012 at 3:08 PM

It crashes when I try to access it. I run in 32 bit.

Coordinator
Dec 23, 2012 at 3:18 PM

that is very strange. I am using WIndows 8, and I have no problem running NAudio demo in any version of .NET (I've tried 4.0 and 4.5). What line does it crash on? Is there a stack trace?

Mark

Dec 23, 2012 at 3:25 PM
Edited Dec 23, 2012 at 3:27 PM

No I don't have a stack trace as the program just crashes. I debugged to see where the problem seemed to be and it seems to occur in the WaveFormatCustomMarshaler when this is called :

in

WaveFormat�SuggestPcmFormat(WaveFormat�compressedFormat)
{
..
MmException.Try(AcmInterop.acmFormatSuggest(IntPtr.Zero,�compressedFormat,�suggestedFormat,�Marshal.SizeOf(suggestedFormat),�AcmFormatSuggestFlags.FormatTag),�"acmFormatSuggest");


        
    
Dec 23, 2012 at 3:51 PM
Edited Dec 23, 2012 at 3:52 PM

Enabling unmanaged code debugging gives me this : 

Unhandled exception at 0x57fc2170 in NAudioDemo.exe: 0xC0000005: Access violation.

 	msaud32_divx.acm!57fc2170() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for msaud32_divx.acm]	
 	msaud32_divx.acm!57fbf195() 	
 	ntdll.dll!77ea2846() 	
 	ntdll.dll!77ea2893() 	
 	ntdll.dll!77ea9cb3() 	
 	ntdll.dll!77ea9b87() 	
 	ntdll.dll!77ea9b10() 	
 	ntdll.dll!77eaa247() 	
 	ntdll.dll!77ea7229() 	
 	KernelBase.dll!7741e7db() 	
 	winmmbase.dll!74cf38be() 	
 	kernel32.dll!77c1f939() 	
 	winmmbase.dll!74cf3e87() 	
 	ntdll.dll!77e91348() 	
 	ntdll.dll!77e6075a() 	
 	ntdll.dll!77e606bd() 	
 	winmmbase.dll!74cf45a7() 	
 	winmmbase.dll!74cf43d4() 	
 	msacm32.dll!73d220d6() 	
 	msacm32.dll!73d220e9() 	
 	msacm32.dll!73d22b04() 	
 	msacm32.dll!73d22dea() 	
 	ntdll.dll!77e9f670() 	
 	ntdll.dll!77e9f62e() 	
 	ntdll.dll!77e9f670() 	
 	ntdll.dll!77e9f62e() 	
 	ntdll.dll!77f2d04a() 	
 	ntdll.dll!77ed8b2a() 	
 	[External Code]	
>	NAudio.dll!NAudio.Wave.Compression.AcmDriver.EnumerateAcmDrivers() Line 133 + 0x2e bytes	C#
 	NAudioDemo.exe!NAudioDemo.AcmPanel.AcmForm_Load(object sender = {NAudioDemo.AcmPanel}, System.EventArgs e = {System.EventArgs}) Line 23 + 0x6 bytes	C#
 	[External Code]	
 	NAudioDemo.exe!NAudioDemo.MainForm.buttonLoadDemo_Click(object sender = {SelectedItem = Cannot evaluate expression because a native frame is on top of the call stack.}, System.EventArgs e = {X = 90 Y = 48 Button = Left}) Line 39 + 0x21 bytes	C#
 	NAudioDemo.exe!NAudioDemo.MainForm.listBoxDemos_DoubleClick(object sender = {SelectedItem = Cannot evaluate expression because a native frame is on top of the call stack.}, System.EventArgs e = {X = 90 Y = 48 Button = Left}) Line 55 + 0xe bytes	C#
 	user32.dll!76fa77d8() 	
 	user32.dll!76fa78cb() 	
 	user32.dll!76fa787a() 	
 	user32.dll!76fa899d() 	
 	user32.dll!76fa8a66() 	
 	[External Code]	
 	NAudioDemo.exe!NAudioDemo.Program.Main() Line 26 + 0x8 bytes	C#
 	mscoreei.dll!7397f5a3() 	
 	kernel32.dll!77c24c95() 	
 	mscoree.dll!739f7f16() 	
 	mscoree.dll!739f4de3() 	
 	kernel32.dll!77c28543() 	
 	ntdll.dll!77eaac69() 	
 	ntdll.dll!77eaac3c() 	
Coordinator
Dec 23, 2012 at 4:12 PM

interesting, looks like you have a divx ACM codec that might be causing the problem. Perhaps its largest WaveFormat size is bigger than the maximum I had allocated (with WaveFormatExtraData). Having said that I can't see how that would cause an access violation.

Are you able to debug against the actual NAudio source code? You could put breakpoints on WaveFormat.MarshalFromPtr and WaveFormat.MarshalToPtr. You could also see if WaveFormatCustomMarshaller.GetNativeDataSize is being called. Perhaps that is a problem.

Dec 23, 2012 at 5:04 PM

I can confirm that MarshalToPtr is being called, and that GetNativeDataSize never is. Since I also crash with the line :

AcmInterop.acmDriverEnum(new AcmInterop.AcmDriverEnumCallback(DriverEnumCallback), IntPtr.Zero, 0);

I'm not sure the problem is with WaveFormat.

Coordinator
Dec 23, 2012 at 5:11 PM

is DriverEnumCallback getting called? Can you try putting a breakpoint on that?

Mark

Dec 23, 2012 at 5:12 PM

Nope, it crashes before that.

Coordinator
Dec 23, 2012 at 6:04 PM

that's very strange. I guess it could be that you have a badly behaving ACM codec, but I would expect at least acmDriverEnum to work. If you go to help | about in Windows Media Player and click tech support information, what ACM codecs does it show?

Dec 23, 2012 at 6:16 PM

 

Audio Codecs

Type Name Format Binary Version
ACM Microsoft GSM 6.10 Audio CODEC 0031 msgsm32.acm 6.2.9200.16384
ACM Microsoft CCITT G.711 A-Law and u-Law CODEC 0007 msg711.acm 6.2.9200.16384
ACM Fraunhofer IIS MPEG Layer-3 Codec (professional) 0055 l3codecp.acm 3.4.0.0
ACM Microsoft IMA ADPCM CODEC 0011 imaadp32.acm 6.2.9200.16384
ACM Microsoft ADPCM CODEC 0002 msadp32.acm 6.2.9200.16384
ACM Messenger Audio Codec 028E sirenacm.dll 15.4.3555.308
ACM Microsoft PCM Converter 0001
Coordinator
Dec 23, 2012 at 6:21 PM

interesting, there is no msaud32_divx.acm in that list. Can you try building your app targetting x64 and see what happens?

Dec 23, 2012 at 6:29 PM

It works now. It seems I have some cleaning up to do with the codecs I have installed. Thanks.

Dec 23, 2012 at 8:05 PM

What's the suggested action for the players of my game? Should I follow these steps?

Coordinator
Dec 23, 2012 at 9:57 PM

hi vaughands, what OS are you running on?

Dec 25, 2012 at 2:20 AM

Windows XP

Coordinator
Dec 25, 2012 at 6:47 PM

OK, use the NAudioDemo application to examine what ACM codecs you do have. XP usually comes with an MP3 decoder so I'm surprised you don't see one.

Mark

Dec 26, 2012 at 12:52 AM

This PC has one and I can assure you the demo application works to play a audio file. (I just tried). So I'm not sure why MY Mp3FileReader would crash on the same file. :(

Coordinator
Dec 26, 2012 at 7:17 AM

is your OS 64 bit and your app running as a 64 bit process by any chance?

Dec 27, 2012 at 2:08 AM

That's not the case, no. Sorry. It looks like it's failing in the try function.

Coordinator
Dec 27, 2012 at 7:18 AM

Well that is very strange - you are saying that NAudioDemo works, but your app with the exact same code doesn't? Are they both using the same version of NAudio?