Jump to content

Recommended Posts

Posted (edited)

Allows recording from eCapture(recording) and eRender (playback) devices

Audio capture UDf in autoit allows you to capture 'what you hear' to a wav file using a loopback

Event driven capturing allows your GUI to stay responsive and doesn't use a lot of your cpu

 

Loosely based on https://github.com/mvaneerde/blog/blob/master/loopback-capture/loopback-capture/loopback-capture.cpp

Wav saving inspired by Eukalyptus https://www.autoitscript.com/forum/topic/164700-directsound-udf/

 

UDF WasApi_Capture.au3

  Reveal hidden contents

Example

  Reveal hidden contents

Edit: added IMMEndpoint.GetDataFlow to allow the loopback flag to be removed from eCapture Devices so you can record eRender and eCapture Devices now

        added _WASAPI_Stream_Dataflow to get device direction eRender (playback), eCapture (recording), eAll

        Cleaned up error handling in the UDF should be more comprehensive (At least CLEANER!)

        Fixed Windows 10 event mode

        Proper handling of Wave Extensible Format, Cleaned up example code a bit

        FIxed Error with Non Wave Extensible Formats and added paused code from Argumentum

        Cleaned up code added the ability to only capture every n number of frames 1Ms in the example

Capture_Example.au3Fetching info... WasApi_capture.au3Fetching info...

Edited by Bilgus
Attached Files
Posted

I added functionality to enumerate the available devices on the system

In doing so I discovered that you get in to a use after free situation if you try to create an interface more than once from the same device pointer.

The device pointers are actually pointers to pointers (ptr**) so even though the underlying pointer is still valid you no longer have access to it.

To remedy this The UDF now passes DeviceIds from the user facing functions and only converts to device pointers as they are ready to be used

 

Posted (edited)

I get an error code brah...

Available Render Endpoints:
Digital Audio (S/PDIF) (High Definition Audio Device)
Digital Audio (S/PDIF) (High Definition Audio Device)
Speakers (I'm Fulla Schiit)

Available Capture Endpoints:


Capturing From: Speakers (I'm Fulla Schiit)
!>13:39:50 AutoIt3.exe ended.rc:-1073741819
+>13:39:50 AutoIt3Wrapper Finished.
>Exit code: 3221225477    Time: 2.695

am i doing something wrong? ps, i love the name of my speakers

i was hoping i could do this to make my own ring tones... for now anyway

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Posted (edited)

@Earthshine

I Updated the UDF and Example to add some more info Try that and post the console output

It might be that your device doesn't support event mode

I still need to flesh out the error handling 

Error handling should be in a much better state now

Edited by Bilgus
Posted (edited)

Ok. My device is an external dac/amp so maybe it doesn’t. I’ll try it when in office again 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Posted

I haven't tried anything but the built-ins on my pc I probably have a usb sound card around here somewhere I just need to find a patch cable so I can test it

I'm kinda surprised that it doesn't throw any errors through the UDF

Posted (edited)

..added some more ConsoleWrite's to better show what's up.

  Reveal hidden contents

it did not record  =/

Edit 1:
 

  Reveal hidden contents

same with a headset

Edit 2:

  Reveal hidden contents

 

Edited by argumentum
more tries

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted

AH, I see you are using windows 10 there.

I read that windows 10 now allows a loopback interface to co exist with even driven mode but maybe thats a LIE

@argumentum can you try editing this line in the UDF?

Around Line 317

    If @OSBuild >= 10000 Then $oIAudioClient_Loopback = 0
    ;On Windows versions prior to Windows 10, a pull-mode capture client will not receive
    ;any events when a stream is initialized with event-driven buffering
    ;(AUDCLNT_STREAMFLAGS_EVENTCALLBACK) and is loopback-enabled (AUDCLNT_STREAMFLAGS_LOOPBACK)

Posted
  On 2/16/2019 at 7:49 PM, Bilgus said:

@argumentum can you try editing this line in the UDF?

Expand  

I removed the line as I don't know what else to do with it.

  Reveal hidden contents

 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted

yeah just comment it out ok so we have events happening now but the files is still 0 Bytes?

That might be an issue in the example try removing this flag

Line 27

    Local $hFile = _WinAPI_CreateFileEx($sTmpFile, $CREATE_ALWAYS, $GENERIC_WRITE, 0, $FILE_ATTRIBUTE_TEMPORARY)

 

Sorry I don't have Windows 10 to test on

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...