Jump to content
  • Advertisement
Sign in to follow this  
XxxFG

managed DirectSound Capture problem

This topic is 4556 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I had problems using managed directsound, when I added reference to Microsoft.DirectX.DirectSound I can play sound without problems, but there is problem capturing sound. The example in C# works fine but when I do the same in C++ there is a System.Exception: Message "Object reference not set to an instance of an object." Source "Microsoft.DirectX.DirectSound" StackTrace " at Microsoft.DirectX.DirectSound.Notify..ctor(CaptureBuffer lp) at CaptureVoice.InitNotifications() in c:\my documents\visual studio projects\capturevoice.cpp:line 84" I'm using MS Visual studio .Net 2003 and DirectX SDK December 2005 and the code is like this: applicationDevice = new Capture(); // Caps is set InputFormat = WaveFormat(); InputFormat.FormatTag = WaveFormatTag::Pcm; InputFormat.BitsPerSample = 8; InputFormat.SamplesPerSecond = 8000; InputFormat.Channels = 1; InputFormat.BlockAlign = (short)(InputFormat.Channels * (InputFormat.BitsPerSample / 8)); InputFormat.AverageBytesPerSecond = InputFormat.BlockAlign * InputFormat.SamplesPerSecond; NotifySize = (1024 > InputFormat.AverageBytesPerSecond / 8) ? 1024 : (InputFormat.AverageBytesPerSecond / 8); NotifySize -= NotifySize % InputFormat.BlockAlign; CaptureBufferSize = NotifySize * NumberRecordNotifications; CaptureBufferDescription dscheckboxd = CaptureBufferDescription(); dscheckboxd.BufferBytes = CaptureBufferSize; dscheckboxd.Format = InputFormat; applicationBuffer = new CaptureBuffer(&dscheckboxd, applicationDevice); // Caps is NOT set NotifyThread = new Thread(new ThreadStart(this,&CaptureVoice::WaitThread)); NotifyThread->Start(); NotificationEvent = new AutoResetEvent(false); applicationNotify = new Notify(applicationBuffer); // this throws exception Can someone help me please, maybe it's some stupid slip but I can't see it. I also have another question, is it possible to use some codecs with managed directsound? thanx

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!