Mercurial > hg > btrack
comparison modules-and-plug-ins/python-module/btrack_python_module.cpp @ 110:0fdaf082ad1a
Got compiling on M1 mac and Python 3
author | Adam Stark <adamstark.uk@gmail.com> |
---|---|
date | Sun, 31 Oct 2021 23:34:44 +0000 |
parents | ce806db4468b |
children |
comparison
equal
deleted
inserted
replaced
109:edb071c0cd1f | 110:0fdaf082ad1a |
---|---|
290 { "trackBeatsFromOnsetDF",btrack_trackBeatsFromOnsetDF,METH_VARARGS,"Track beats from an onset detection function"}, | 290 { "trackBeatsFromOnsetDF",btrack_trackBeatsFromOnsetDF,METH_VARARGS,"Track beats from an onset detection function"}, |
291 {NULL, NULL, 0, NULL} /* Sentinel */ | 291 {NULL, NULL, 0, NULL} /* Sentinel */ |
292 }; | 292 }; |
293 | 293 |
294 //======================================================================= | 294 //======================================================================= |
295 PyMODINIT_FUNC initbtrack(void) | 295 static struct PyModuleDef btrack_definition = { |
296 { | 296 PyModuleDef_HEAD_INIT, |
297 (void)Py_InitModule("btrack", btrack_methods); | 297 "btrack", |
298 "Python bindings for the BTrack beat tracker", | |
299 -1, | |
300 btrack_methods | |
301 }; | |
302 | |
303 //======================================================================= | |
304 PyMODINIT_FUNC PyInit_btrack(void) | |
305 { | |
298 import_array(); | 306 import_array(); |
307 return PyModule_Create(&btrack_definition); | |
299 } | 308 } |
300 | 309 |
301 //======================================================================= | 310 //======================================================================= |
302 int main(int argc, char *argv[]) | 311 int main(int argc, char *argv[]) |
303 { | 312 { |
304 /* Pass argv[0] to the Python interpreter */ | 313 wchar_t* program = Py_DecodeLocale (argv[0], NULL); |
305 Py_SetProgramName(argv[0]); | 314 Py_SetProgramName (program); |
306 | 315 |
307 /* Initialize the Python interpreter. Required. */ | 316 /* Initialize the Python interpreter. Required. */ |
308 Py_Initialize(); | 317 Py_Initialize(); |
309 | 318 |
310 /* Add a static module */ | 319 /* Add a static module */ |
311 initbtrack(); | 320 PyInit_btrack(); |
312 } | 321 } |