
8 changed files with 36 additions and 199 deletions
@ -1,11 +1,20 @@ |
|||||
YML2_PATH=$(HOME)/src/pepbase/default/yml2 |
include Makefile.conf |
||||
YML2_PROC=$(YML2_PATH)/yml2proc $(YML2_OPTS) |
|
||||
YML2_OPTS=--encoding=utf8 |
|
||||
|
|
||||
|
YML2_FILE=py_module.yml2 |
||||
|
CC_FILE=py_module.cc |
||||
|
|
||||
py_module.cc : gen_pybind.ysl2 cid_grammar.yml2 |
|
||||
$(YML2_PROC) -y $< cid_grammar.yml2 |
.PHONY = yml cc |
||||
|
|
||||
|
all: yml cc |
||||
|
|
||||
|
yml: |
||||
|
$(GEN_CID_DIR)/gen_yml.py $(abspath config.json) |
||||
|
|
||||
|
cc : $(YML2_FILE) |
||||
|
$(YML2_PROC) -y $(GEN_CID_DIR)/gen_cc.ysl2 $(YML2_FILE) |
||||
|
|
||||
clean: |
clean: |
||||
echo -f $(YML2_MARKERS) |
rm -f $(YML2_FILE) |
||||
|
rm -f $(CC_FILE) |
||||
|
|
||||
|
@ -0,0 +1,5 @@ |
|||||
|
YML2_PATH=$(HOME)/src/pepbase/default/yml2 |
||||
|
YML2_PROC=$(YML2_PATH)/yml2proc $(YML2_OPTS) |
||||
|
YML2_OPTS=--encoding=utf8 |
||||
|
|
||||
|
GEN_CID_DIR=../../gen_cid/ |
@ -1,65 +0,0 @@ |
|||||
decl method @name; |
|
||||
|
|
||||
decl struct @name; |
|
||||
decl field @name; |
|
||||
|
|
||||
decl enum @name; |
|
||||
decl item @name; |
|
||||
|
|
||||
namespace pEp { |
|
||||
|
|
||||
method init_synth_shed { |
|
||||
return type="void"; |
|
||||
}; |
|
||||
|
|
||||
method synth_create { |
|
||||
return type="synth_t *"; |
|
||||
use name type="const char *"; |
|
||||
}; |
|
||||
|
|
||||
method synth_set_osc_count { |
|
||||
return type="SYNTH_STATUS"; |
|
||||
use synth type="synth_t *"; |
|
||||
use osc_count type="int"; |
|
||||
}; |
|
||||
|
|
||||
method tech_to_string { |
|
||||
return type="const char *"; |
|
||||
use tech type="const tech_t *"; |
|
||||
}; |
|
||||
|
|
||||
method filtertype_to_string { |
|
||||
return type="const char *"; |
|
||||
use filt type="const filtertype_t *"; |
|
||||
}; |
|
||||
|
|
||||
method play_synth { |
|
||||
return type="const char *"; |
|
||||
use synth type="synth_t *"; |
|
||||
}; |
|
||||
|
|
||||
struct _synth { |
|
||||
field model_name type="const char *"; |
|
||||
field osc_count type="int"; |
|
||||
field technolgy type="tech_t"; |
|
||||
field filter type="filter_t"; |
|
||||
}; |
|
||||
|
|
||||
struct _filter { |
|
||||
field technology type="tech_t"; |
|
||||
field type type="filtertype_t"; |
|
||||
}; |
|
||||
|
|
||||
enum _tech { |
|
||||
item ANALOG value=0; |
|
||||
item DIGITAL value=1; |
|
||||
}; |
|
||||
|
|
||||
enum _filtertype { |
|
||||
item HPF value=0; |
|
||||
item LPF value=1; |
|
||||
item BPF value=2; |
|
||||
}; |
|
||||
|
|
||||
|
|
||||
} |
|
@ -0,0 +1,16 @@ |
|||||
|
{ |
||||
|
"module_name": "synth_shed", |
||||
|
"header_filename": "../../src/synth_shed/synth_shed.h", |
||||
|
"libclang_path": "/opt/local/libexec/llvm-9.0/lib/libclang.dylib", |
||||
|
"variables": [ |
||||
|
], |
||||
|
"functions": [ |
||||
|
"init_synth_shed", |
||||
|
"synth_create", |
||||
|
"synth_set_osc_count", |
||||
|
"tech_to_string", |
||||
|
"update_identity", |
||||
|
"filtertype_to_string", |
||||
|
"play_synth" |
||||
|
] |
||||
|
} |
@ -1 +0,0 @@ |
|||||
"" |
|
@ -1,44 +0,0 @@ |
|||||
#include <string> |
|
||||
#include <iostream> |
|
||||
#include <pybind11/pybind11.h> |
|
||||
#include <pybind11/detail/common.h> |
|
||||
#include "synth_shed.h" |
|
||||
|
|
||||
using namespace std; |
|
||||
namespace py = pybind11; |
|
||||
|
|
||||
PYBIND11_MODULE(synth_shed, m) { |
|
||||
|
|
||||
m.def("init_synth_shed", &init_synth_shed, ""); |
|
||||
m.def("synth_create", &synth_create, ""); |
|
||||
m.def("synth_set_osc_count", &synth_set_osc_count, ""); |
|
||||
m.def("tech_to_string", &tech_to_string, ""); |
|
||||
m.def("filtertype_to_string", &filtertype_to_string, ""); |
|
||||
m.def("play_synth", &play_synth, ""); |
|
||||
|
|
||||
py::class_<_synth>(m, "_synth") |
|
||||
.def_readwrite("model_name", &::_synth::model_name) |
|
||||
.def_readwrite("osc_count", &::_synth::osc_count) |
|
||||
.def_readwrite("technolgy", &::_synth::technolgy) |
|
||||
.def_readwrite("filter", &::_synth::filter) |
|
||||
; |
|
||||
|
|
||||
py::class_<_filter>(m, "_filter") |
|
||||
.def_readwrite("technology", &::_filter::technology) |
|
||||
.def_readwrite("type", &::_filter::type) |
|
||||
; |
|
||||
|
|
||||
|
|
||||
py::enum_<::_tech>(m, "_tech") |
|
||||
.value("ANALOG", ::ANALOG, "") |
|
||||
.value("DIGITAL", ::DIGITAL, "") |
|
||||
; |
|
||||
|
|
||||
py::enum_<::_filtertype>(m, "_filtertype") |
|
||||
.value("HPF", ::HPF, "") |
|
||||
.value("LPF", ::LPF, "") |
|
||||
.value("BPF", ::BPF, "") |
|
||||
; |
|
||||
|
|
||||
|
|
||||
} |
|
@ -1,53 +0,0 @@ |
|||||
method init_synth_shed { |
|
||||
return type="void"; |
|
||||
}; |
|
||||
|
|
||||
method synth_create { |
|
||||
return type="synth_t *"; |
|
||||
use name type="const char *"; |
|
||||
}; |
|
||||
|
|
||||
method synth_set_osc_count { |
|
||||
return type="SYNTH_STATUS"; |
|
||||
use synth type="synth_t *"; |
|
||||
use osc_count type="int"; |
|
||||
}; |
|
||||
|
|
||||
method tech_to_string { |
|
||||
return type="const char *"; |
|
||||
use tech type="const tech_t *"; |
|
||||
}; |
|
||||
|
|
||||
method filtertype_to_string { |
|
||||
return type="const char *"; |
|
||||
use filt type="const filtertype_t *"; |
|
||||
}; |
|
||||
|
|
||||
method play_synth { |
|
||||
return type="const char *"; |
|
||||
use synth type="synth_t *"; |
|
||||
}; |
|
||||
|
|
||||
struct _synth { |
|
||||
field model_name type="const char *"; |
|
||||
field osc_count type="int"; |
|
||||
field technolgy type="tech_t"; |
|
||||
field filter type="filter_t"; |
|
||||
}; |
|
||||
|
|
||||
struct _filter { |
|
||||
field technology type="tech_t"; |
|
||||
field type type="filtertype_t"; |
|
||||
}; |
|
||||
|
|
||||
enum _tech { |
|
||||
item ANALOG value=0; |
|
||||
item DIGITAL value=1; |
|
||||
}; |
|
||||
|
|
||||
enum _filtertype { |
|
||||
item HPF value=0; |
|
||||
item LPF value=1; |
|
||||
item BPF value=2; |
|
||||
}; |
|
||||
|
|
@ -1,30 +0,0 @@ |
|||||
#!/usr/bin/env python3 |
|
||||
# -*- coding: utf-8 -*- |
|
||||
|
|
||||
import gen_cid |
|
||||
from gen_cid import utils |
|
||||
|
|
||||
def main(): |
|
||||
vars = [] |
|
||||
funcs = [] |
|
||||
funcs.append("init_synth_shed") |
|
||||
funcs.append("synth_create") |
|
||||
funcs.append("synth_set_osc_count") |
|
||||
funcs.append("tech_to_string") |
|
||||
funcs.append("update_identity") |
|
||||
funcs.append("filtertype_to_string") |
|
||||
funcs.append("play_synth") |
|
||||
|
|
||||
header_filename = "../../src/synth_shed/synth_shed.h" |
|
||||
libclang_path = "/opt/local/libexec/llvm-9.0/lib/libclang.dylib" |
|
||||
|
|
||||
cidtools = gen_cid.CIDTools(libclang_path, header_filename, "synth_shed") |
|
||||
header = cidtools.extract(vars, funcs, debug_ast=True, debug_cid=True, debug_yml=True) |
|
||||
|
|
||||
print(header["yml"]) |
|
||||
utils.write_string(header["yml"], "./" + "/" + header["filename"] + ".cid.yml2", ) |
|
||||
|
|
||||
|
|
||||
|
|
||||
if __name__ == "__main__": |
|
||||
main() |
|
Loading…
Reference in new issue