framework icon indicating copy to clipboard operation
framework copied to clipboard

SharpDX.SharpDXException when starting audio source

Open DivyaZolio opened this issue 6 years ago • 1 comments

When I'm trying to record audio using accord.net, it throws an exception

Accord.Audio.DirectSound.pdb not loaded $exception {"HRESULT: [0x88780064], Module: [Unknown], ApiCode: [Unknown/Unknown], Message: Unknown"} SharpDX.SharpDXException

I'm using Windows 10 Pro 64 bit with Visual Studio 2017. Accord.Audio - v3.8.0 Accord.Audio.DirectSound - v3.8.0 SharpDX -v2.6.3 SharpDX.DirectSound - v2.6.3

My code is here

 `using Accord.DirectSound;
  using Accord.Audio;
  namespace TestAudio
 {
public partial class Form1 : Form
{
    private Signal s;
    public Form1()
    {
        InitializeComponent();
    }
    private void Form1_Load(object sender, EventArgs e)
    {  
        AudioCaptureDevice source = new AudioCaptureDevice();
        source.DesiredFrameSize = 4096;
        source.SampleRate = 22050;
        source.NewFrame += source_NewFrame;
        source.Start();
    }
    private void source_NewFrame(object sender, Accord.Audio.NewFrameEventArgs eventArgs)
    {
        s = eventArgs.Signal;
    }
    }
  }

`

DivyaZolio avatar Jun 06 '19 06:06 DivyaZolio

I get (probably) the same exception when the microphone is disabled for 3rd party application in Win10 system settings. Which will cause NullReferenceException at Accord.DirectSound.AudioCaptureDevice.WorkerThread()

SharpDX.SharpDXException: HRESULT: [0x80004005], Module: [General], ApiCode: [E_FAIL/Unspecified error], Message: Unspecified error in SharpDX.Result.CheckError() in SharpDX.DirectSound.DirectSoundCapture.CreateCaptureBuffer(CaptureBufferDescription cDSCBufferDescRef, CaptureBufferBase& dSCBufferOut, ComObject unkOuterRef) in SharpDX.DirectSound.CaptureBuffer..ctor(DirectSoundCapture capture, CaptureBufferDescription description) in Accord.DirectSound.AudioCaptureDevice.WorkerThread() v SharpDX.Result.CheckError() in SharpDX.DirectSound.DirectSoundCapture.CreateCaptureBuffer(CaptureBufferDescription cDSCBufferDescRef, CaptureBufferBase& dSCBufferOut, ComObject unkOuterRef) v SharpDX.DirectSound.CaptureBuffer..ctor(DirectSoundCapture capture, CaptureBufferDescription description) v Accord.DirectSound.AudioCaptureDevice.WorkerThread()

System.NullReferenceException: The object reference is not set to an instance of an object in Accord.DirectSound.AudioCaptureDevice.WorkerThread() in System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) in System.Threading.ThreadHelper.ThreadStart() v Accord.DirectSound.AudioCaptureDevice.WorkerThread() in System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) in System.Threading.ThreadHelper.ThreadStart()

Jigfreed avatar Jul 24 '20 12:07 Jigfreed