Sign in to follow this  

managed DirectSound Capture problem

This topic is 4338 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

This topic is 4338 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this