From 43860dc30812830efb4be9fb0de04d8514ac0689 Mon Sep 17 00:00:00 2001 From: Tony Su Date: Fri, 29 Sep 2017 21:13:54 +0800 Subject: [PATCH] add a sample about how python use C# dll --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 256a274..39f176a 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,20 @@ pip install pulsectl --time capture specific milliseconds --int-16 attempts to coerce data to 16-bit integer format +# Python (DLL) + +> import os, sys, platform, clr +> if platform.architecture()[0] == "32bit": +> DLL_PATH = r"win32\dll\LoopbackCapture\LoopbackCapture\bin\x86\Release" +> elif platform.architecture()[0] == "64bit": +> DLL_PATH = r"win32\dll\LoopbackCapture\LoopbackCapture\bin\x64\Release" +> DLL_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), DLL_PATH) +> sys.path.append(DLL_PATH) +> clr.AddReference("LoopbackCapture") +> from LoopbackCapture import LoopbackCapture +> lc = LoopbackCapture() +> lc.Capture("record.wav", 15000) + # Python (macOS) > from mac.LoopbackCapture import record_sounds