diff options
author | Spacelord <spacelord09@users.noreply.github.com> | 2020-03-08 21:08:53 +0100 |
---|---|---|
committer | Spacelord <spacelord09@users.noreply.github.com> | 2020-03-08 21:08:53 +0100 |
commit | 2cffce783bcc4f34f6a609bf446530f350be04a2 (patch) | |
tree | dfe6c476a3c271b4d3a770db66bc55c9b42a62a5 /backends/python.md | |
parent | 26d661fa01df5cb2569432413ad91df891d088f2 (diff) | |
parent | 5f4b349aff49be0a5f6895631a93c47fcafcff93 (diff) | |
download | midimonster-2cffce783bcc4f34f6a609bf446530f350be04a2.tar.gz midimonster-2cffce783bcc4f34f6a609bf446530f350be04a2.tar.bz2 midimonster-2cffce783bcc4f34f6a609bf446530f350be04a2.zip |
Merge branches 'master' and 'master' of github.com:cbdevnet/midimonster
Diffstat (limited to 'backends/python.md')
-rw-r--r-- | backends/python.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/backends/python.md b/backends/python.md index b6a1162..f06e504 100644 --- a/backends/python.md +++ b/backends/python.md @@ -25,11 +25,11 @@ The `midimonster` module provides the following functions: | `manage(function, socket)` | `midimonster.manage(handler, socket)`| Register a (connected/listening) socket to the MIDIMonster core. Calls `function(socket)` when the socket is ready to read. Calling this method with `None` as the function argument unregisters the socket. A socket may only have one associated handler | Example Python module: -``` +```python import socket import midimonster -# Simple channel ahndler +# Simple channel handler def in1(value): midimonster.output("out1", 1 - value) @@ -45,14 +45,14 @@ def socket_handler(sock): # Interval handler def ping(): - print(midimonster.interval()) + print(midimonster.timestamp()) # Register an interval midimonster.interval(ping, 1000) # Create and register a client socket (add error handling as you like) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("localhost", 8990)) -midimonster.manage(reader, s) +midimonster.manage(socket_handler, s) ``` Input values range between 0.0 and 1.0, output values are clamped to the same range. |