From 0529a60f464801f27817817b68410e5cd1e088f6 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sun, 21 Jun 2015 13:10:40 +0200 Subject: Remove logging, add get_status() --- examples/play_file.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/play_file.py b/examples/play_file.py index 7161ceb..8483777 100755 --- a/examples/play_file.py +++ b/examples/play_file.py @@ -5,6 +5,7 @@ PySoundFile (https://github.com/bastibe/PySoundFile/) has to be installed! """ import argparse +import logging parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("filename", help="audio file to be played back") @@ -15,7 +16,10 @@ try: import sounddevice as sd import soundfile as sf data, fs = sf.read(args.filename, dtype='float32') - sd.play(data, fs, device=args.device, blocking=True) + sd.play(data, fs, device=args.device) + status = sd.wait() + if status: + logging.warning(str(status)) except BaseException as e: # This avoids printing the traceback, especially if Ctrl-C is used. raise SystemExit(str(e)) -- cgit v1.2.3