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