fazekasgy@37
|
1 /*
|
fazekasgy@37
|
2
|
fazekasgy@37
|
3 * Vampy : This plugin is a wrapper around the Vamp plugin API.
|
fazekasgy@37
|
4 * It allows for writing Vamp plugins in Python.
|
fazekasgy@37
|
5
|
fazekasgy@37
|
6 * Centre for Digital Music, Queen Mary University of London.
|
fazekasgy@37
|
7 * Copyright (C) 2008-2009 Gyorgy Fazekas, QMUL. (See Vamp sources
|
fazekasgy@37
|
8 * for licence information.)
|
fazekasgy@37
|
9
|
fazekasgy@37
|
10 */
|
fazekasgy@37
|
11
|
fazekasgy@37
|
12 /*
|
fazekasgy@37
|
13 Vamp
|
fazekasgy@37
|
14
|
fazekasgy@37
|
15 An API for audio analysis and feature extraction plugins.
|
fazekasgy@37
|
16
|
fazekasgy@37
|
17 Centre for Digital Music, Queen Mary, University of London.
|
fazekasgy@37
|
18 Copyright 2006-2007 Chris Cannam and QMUL.
|
fazekasgy@37
|
19
|
fazekasgy@37
|
20 Permission is hereby granted, free of charge, to any person
|
fazekasgy@37
|
21 obtaining a copy of this software and associated documentation
|
fazekasgy@37
|
22 files (the "Software"), to deal in the Software without
|
fazekasgy@37
|
23 restriction, including without limitation the rights to use, copy,
|
fazekasgy@37
|
24 modify, merge, publish, distribute, sublicense, and/or sell copies
|
fazekasgy@37
|
25 of the Software, and to permit persons to whom the Software is
|
fazekasgy@37
|
26 furnished to do so, subject to the following conditions:
|
fazekasgy@37
|
27
|
fazekasgy@37
|
28 The above copyright notice and this permission notice shall be
|
fazekasgy@37
|
29 included in all copies or substantial portions of the Software.
|
fazekasgy@37
|
30
|
fazekasgy@37
|
31 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
fazekasgy@37
|
32 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
fazekasgy@37
|
33 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
fazekasgy@37
|
34 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
|
fazekasgy@37
|
35 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
fazekasgy@37
|
36 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
fazekasgy@37
|
37 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
fazekasgy@37
|
38
|
fazekasgy@37
|
39 Except as contained in this notice, the names of the Centre for
|
fazekasgy@37
|
40 Digital Music; Queen Mary, University of London; and Chris Cannam
|
fazekasgy@37
|
41 shall not be used in advertising or otherwise to promote the sale,
|
fazekasgy@37
|
42 use or other dealings in this Software without prior written
|
fazekasgy@37
|
43 authorization.
|
fazekasgy@37
|
44 */
|
fazekasgy@37
|
45
|
fazekasgy@37
|
46 #ifndef _VAMP_PYPLUG_SCANNER_H_
|
fazekasgy@37
|
47 #define _VAMP_PYPLUG_SCANNER_H_
|
fazekasgy@37
|
48
|
fazekasgy@37
|
49 #include <Python.h>
|
fazekasgy@37
|
50 #include <iostream>
|
fazekasgy@37
|
51 #include <vector>
|
fazekasgy@37
|
52 #include <string>
|
fazekasgy@37
|
53 #include <map>
|
fazekasgy@37
|
54 //#include <fstream>
|
fazekasgy@37
|
55
|
fazekasgy@37
|
56 class PyPlugScanner
|
fazekasgy@37
|
57 {
|
fazekasgy@37
|
58 public:
|
fazekasgy@37
|
59 ~PyPlugScanner() { m_hasInstance = false; }
|
fazekasgy@37
|
60 static PyPlugScanner *getInstance();
|
fazekasgy@37
|
61 std::vector<std::string> getPyPlugs();
|
fazekasgy@37
|
62 std::vector<PyObject*> getPyClasses();
|
fazekasgy@37
|
63 void setPath(std::vector<std::string> path);
|
fazekasgy@37
|
64 std::vector<std::string> getAllValidPath();
|
fazekasgy@37
|
65
|
fazekasgy@37
|
66 protected:
|
fazekasgy@37
|
67 PyPlugScanner();
|
fazekasgy@37
|
68 PyObject *getScriptClass(std::string path, std::string classname);
|
fazekasgy@37
|
69 std::vector<std::string> listFiles(std::string dir, std::string ext);
|
fazekasgy@37
|
70 void mergeFileLists(std::vector<std::string> &s, std::vector<std::string> &t);
|
fazekasgy@37
|
71
|
fazekasgy@37
|
72 static bool m_hasInstance;
|
fazekasgy@37
|
73 static PyPlugScanner *m_instance;
|
fazekasgy@37
|
74 std::string m_dir;
|
fazekasgy@37
|
75 std::vector<std::string> m_path;
|
fazekasgy@37
|
76 std::vector<PyObject*> m_pyClasses;
|
fazekasgy@37
|
77 };
|
fazekasgy@37
|
78
|
fazekasgy@37
|
79 #endif
|
fazekasgy@37
|
80
|