From 0548d82295778e9447fdd77c7377a63c747e02a6 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Fri, 23 Jun 2023 17:54:08 +0100 Subject: [PATCH] add new levels example --- examples/levels/README.md | 13 +++++++++++++ examples/levels/__main__.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 examples/levels/README.md create mode 100644 examples/levels/__main__.py diff --git a/examples/levels/README.md b/examples/levels/README.md new file mode 100644 index 0000000..a4c7a33 --- /dev/null +++ b/examples/levels/README.md @@ -0,0 +1,13 @@ +## About + +The purpose of this script is to demonstrate: + +- use of the interface without a context manager. +- retrieving level values for channels by polling (instead of receiving data as event) +- use of the interface without the events thread running. + +## Use + +Configured for potato version. + +Make sure you are playing audio into the first virtual strip and out of the first physical bus, both channels are unmuted and that you aren't monitoring another mixbus. Then run the script. diff --git a/examples/levels/__main__.py b/examples/levels/__main__.py new file mode 100644 index 0000000..fd5f907 --- /dev/null +++ b/examples/levels/__main__.py @@ -0,0 +1,28 @@ +import logging +import time + +import voicemeeterlib + +logging.basicConfig(level=logging.INFO) + + +def main(): + KIND_ID = "potato" + + vm = voicemeeterlib.api(KIND_ID) + vm.login() + for _ in range(500): + print( + "\n".join( + [ + f"{vm.strip[5]}: {vm.strip[5].levels.postmute}", + f"{vm.bus[1]}: {vm.bus[0].levels.all}", + ] + ) + ) + time.sleep(0.033) + vm.logout() + + +if __name__ == "__main__": + main()