Skip to content

Commit

Permalink
add LoopbackCapture.py for win32
Browse files Browse the repository at this point in the history
  • Loading branch information
peitaosu committed Sep 28, 2017
1 parent 8bc304c commit 6dadb16
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions win32/LoopbackCapture.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os, sys, subprocess

def record_sounds(output_file="record.wav", time=0):
if "LOOPBACK_CAPTURE" not in os.environ:
print "Please set the %LOOPBACK_CAPTURE% before you start to capture."
sys.exit(-1)
if not os.path.isfile(os.environ["LOOPBACK_CAPTURE"]):
print "File Not Found. Please make sure the %LOOPBACK_CAPTURE% is correct."
sys.exit(-1)
Loopback_Capture_Path = os.environ["LOOPBACK_CAPTURE"]
if time is not 0:
process = subprocess.Popen("{} {} {}".format(
Loopback_Capture_Path, output_file, time), stdout=subprocess.PIPE)
exit_code = process.wait()
else:
process = subprocess.Popen("{} {}".format(
Loopback_Capture_Path, output_file), stdout=subprocess.PIPE)
exit_code = process.wait()
return exit_code
Empty file added win32/__init__.py
Empty file.

0 comments on commit 6dadb16

Please sign in to comment.