From fe84e353f2580315804319438b1951752249a9ee Mon Sep 17 00:00:00 2001 From: cbdev Date: Tue, 3 Mar 2020 23:11:14 +0100 Subject: Implement python backend --- backends/python.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 backends/python.h (limited to 'backends/python.h') diff --git a/backends/python.h b/backends/python.h new file mode 100644 index 0000000..10411ca --- /dev/null +++ b/backends/python.h @@ -0,0 +1,25 @@ +#include "midimonster.h" + +MM_PLUGIN_API int init(); +static int python_configure(char* option, char* value); +static int python_configure_instance(instance* inst, char* option, char* value); +static int python_instance(instance* inst); +static channel* python_channel(instance* inst, char* spec, uint8_t flags); +static int python_set(instance* inst, size_t num, channel** c, channel_value* v); +static int python_handle(size_t num, managed_fd* fds); +static int python_start(size_t n, instance** inst); +static int python_shutdown(size_t n, instance** inst); + +typedef struct /*_python_channel_data*/ { + char* name; + PyObject* handler; + double in; + double out; +} mmpython_channel; + +typedef struct /*_python_instance_data*/ { + PyThreadState* interpreter; + size_t channels; + mmpython_channel* channel; + mmpython_channel* current_channel; +} python_instance_data; -- cgit v1.2.3 From 38d3724b2af3c2b08c548326797c2421b054c846 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sun, 8 Mar 2020 13:24:33 +0100 Subject: Implement python intervaling and socket management --- backends/python.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'backends/python.h') diff --git a/backends/python.h b/backends/python.h index 10411ca..8ca12f9 100644 --- a/backends/python.h +++ b/backends/python.h @@ -1,6 +1,7 @@ #include "midimonster.h" MM_PLUGIN_API int init(); +static uint32_t python_interval(); static int python_configure(char* option, char* value); static int python_configure_instance(instance* inst, char* option, char* value); static int python_instance(instance* inst); @@ -17,8 +18,26 @@ typedef struct /*_python_channel_data*/ { double out; } mmpython_channel; +typedef struct /*_mmpy_registered_socket*/ { + int fd; + PyObject* handler; + PyObject* socket; +} mmpy_socket; + +typedef struct /*_mmpy_interval*/ { + uint64_t interval; + uint64_t delta; + PyObject* reference; + PyThreadState* interpreter; +} mmpy_timer; + typedef struct /*_python_instance_data*/ { PyThreadState* interpreter; + PyObject* config; //TODO + + size_t sockets; + mmpy_socket* socket; + size_t channels; mmpython_channel* channel; mmpython_channel* current_channel; -- cgit v1.2.3 From 9718e10c7f4151cea895f515c785c14e0021d967 Mon Sep 17 00:00:00 2001 From: cbdev Date: Wed, 18 Mar 2020 22:36:35 +0100 Subject: Implement default channel handlers for Lua/Python --- backends/python.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'backends/python.h') diff --git a/backends/python.h b/backends/python.h index 8ca12f9..a40098b 100644 --- a/backends/python.h +++ b/backends/python.h @@ -41,4 +41,7 @@ typedef struct /*_python_instance_data*/ { size_t channels; mmpython_channel* channel; mmpython_channel* current_channel; + + char* default_handler; + PyObject* handler; } python_instance_data; -- cgit v1.2.3 From aa02ccf3abf183207b24fcbb9460cbd904a698e2 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sun, 22 Mar 2020 00:30:13 +0100 Subject: Enable load-time channel setting for python --- backends/python.h | 1 + 1 file changed, 1 insertion(+) (limited to 'backends/python.h') diff --git a/backends/python.h b/backends/python.h index a40098b..020aeac 100644 --- a/backends/python.h +++ b/backends/python.h @@ -16,6 +16,7 @@ typedef struct /*_python_channel_data*/ { PyObject* handler; double in; double out; + uint8_t mark; } mmpython_channel; typedef struct /*_mmpy_registered_socket*/ { -- cgit v1.2.3