Skip to content

Commit

Permalink
#140.
Browse files Browse the repository at this point in the history
  • Loading branch information
gogins committed Jun 11, 2020
1 parent 0ffb11d commit 91ae738
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CsoundAC/Cell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ class SILENCE_PUBLIC Stack :
* first (0th) node.
*/
double duration;
virtual double getDuration() const {
return duration;
}
virtual double setDuration(double value) {
duration = value;
}
Stack();
virtual ~Stack();
virtual void traverse(const Eigen::MatrixXd &globalCoordinates,
Expand Down
15 changes: 15 additions & 0 deletions CsoundAC/System.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,21 @@ class SILENCE_PUBLIC System
* Make some sort of noticeable sound.
*/
static void beep();
static void message_text(std::string text) {
message(text.c_str());
}
static void debug_text(std::string text) {
debug(text.c_str());
}
static void inform_text(std::string text) {
inform(text.c_str());
}
static void warn_text(std::string text) {
warn(text.c_str());
}
static void error_text(std::string text) {
error(text.c_str());
}
};

/**
Expand Down
97 changes: 95 additions & 2 deletions WebAssembly/CsoundAC/csoundac_embind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,9 +720,10 @@ EMSCRIPTEN_BINDINGS(csoundac) {
.function("transpose_degrees", &csound::Scale::transpose_degrees)
.function("transpose_to_degree", &csound::Scale::transpose_to_degree)
;
// FINISHED
emscripten::class_<csound::Score>("Score")
.constructor<>()
.function("append_note", &csound::Score::append_note)
.function("append", &csound::Score::append_note)
.function("append_event", &csound::Score::append_event)
.function("arrange_all", &csound::Score::arrange_all)
.function("getCsoundScore", &csound::Score::getCsoundScore)
Expand Down Expand Up @@ -764,12 +765,104 @@ EMSCRIPTEN_BINDINGS(csoundac) {
.function("voicelead", &csound::Score::voicelead_segments)
.function("voicelead_pitches", &csound::Score::voicelead_pitches)
.function("setPTV", &csound::Score::setPTV)
;
;
// FINISHED
emscripten::class_<csound::ScoreModel, emscripten::base<csound::Composition> >("ScoreModel")
.constructor<>()
// Repeating Node methods here to make up for lack of multiple inheritance.
.function("addChild", &csound::ScoreModel::addChild, emscripten::allow_raw_pointers())
.function("childCount", &csound::ScoreModel::childCount)
.function("clear", &csound::ScoreModel::clear)
.function("createTransform", &csound::ScoreModel::createTransform)
.function("element", &csound::ScoreModel::element)
.function("generate", &csound::ScoreModel::generate)
.function("getChild", &csound::ScoreModel::getChild, emscripten::allow_raw_pointers())
.function("getLocalCoordinates", &csound::ScoreModel::getLocalCoordinates)
.function("setElement", &csound::ScoreModel::setElement)
.function("transform", &csound::ScoreModel::transform)
.function("traverse", &csound::ScoreModel::traverse)
// End of Node methods.
.function("getThisNode", &csound::ScoreModel::getThisNode, emscripten::allow_raw_pointers())
.function("initialize", &csound::ScoreModel::initialize)
;
// FINISHED
emscripten::class_<csound::ScoreNode, emscripten::base<csound::Node> >("ScoreNode")
.constructor<>()
.function("getScore", &csound::ScoreNode::getScore, emscripten::allow_raw_pointers())
;
// FINISHED
emscripten::class_<csound::Sequence, emscripten::base<csound::Node> >("Sequence")
.constructor<>()
;
// FINISHED
emscripten::class_<csound::Stack, emscripten::base<csound::ScoreNode> >("Stack")
.constructor<>()
.property("duration", &csound::Stack::getDuration, &csound::Stack::setDuration)
;
// FINISHED
emscripten::class_<csound::StrangeAttractor, emscripten::base<csound::ScoreNode> >("StrangeAttractor")
.constructor<>()
.function("calculateFractalDimension", &csound::StrangeAttractor::calculateFractalDimension)
.function("calculateLyupanovExponent", &csound::StrangeAttractor::calculateLyupanovExponent)
.function("codeRandomize", &csound::StrangeAttractor::codeRandomize)
.function("evaluateAttractor", &csound::StrangeAttractor::evaluateAttractor)
.function("getAttractorType", &csound::StrangeAttractor::getAttractorType)
.function("getCode", &csound::StrangeAttractor::getCode)
.function("getCoefficients", &csound::StrangeAttractor::getCoefficients)
.function("getDimensionAndOrder", &csound::StrangeAttractor::getDimensionAndOrder)
.function("getDimensionCount", &csound::StrangeAttractor::getDimensionCount)
.function("getFractalDimension", &csound::StrangeAttractor::getFractalDimension)
.function("getIteration", &csound::StrangeAttractor::getIteration)
.function("getIterationCount", &csound::StrangeAttractor::getIterationCount)
.function("getLyupanovExponent", &csound::StrangeAttractor::getLyupanovExponent)
.function("getScoreType", &csound::StrangeAttractor::getScoreType)
.function("getW", &csound::StrangeAttractor::getW)
.function("getX", &csound::StrangeAttractor::getX)
.function("getY", &csound::StrangeAttractor::getY)
.function("getZ", &csound::StrangeAttractor::getZ)
.function("initialize", &csound::StrangeAttractor::initialize)
.function("iterate", &csound::StrangeAttractor::iterate)
.function("reinitialize", &csound::StrangeAttractor::reinitialize)
.function("render", &csound::StrangeAttractor::render)
.function("reset", &csound::StrangeAttractor::reset)
.function("searchForAttractor", &csound::StrangeAttractor::searchForAttractor)
.function("setAttractorType", &csound::StrangeAttractor::setAttractorType)
.function("setCode", &csound::StrangeAttractor::setCode)
.function("setDimensionCount", &csound::StrangeAttractor::setDimensionCount)
.function("setIteration", &csound::StrangeAttractor::setIteration)
.function("setIterationCount", &csound::StrangeAttractor::setIterationCount)
.function("setScoreType", &csound::StrangeAttractor::setScoreType)
.function("setAttractorType", &csound::StrangeAttractor::setAttractorType)
.function("setAttractorType", &csound::StrangeAttractor::setAttractorType)
.function("setW", &csound::StrangeAttractor::setW)
.function("setX", &csound::StrangeAttractor::setX)
.function("setY", &csound::StrangeAttractor::setY)
.function("setZ", &csound::StrangeAttractor::setZ)
.function("shuffleRandomNumbers", &csound::StrangeAttractor::shuffleRandomNumbers)
.function("specialFunctions", &csound::StrangeAttractor::specialFunctions)
;
// FINISHED
// Mostly not supported and not used, much else simplified.
emscripten::class_<csound::System>("System")
.constructor<>()
.function("beep", &csound::System::beep)
.function("debug", &csound::System::debug_text)
.function("error", &csound::System::error_text)
.function("execute", &csound::System::execute)
.function("getDirectoryNames", &csound::System::getDirectoryNames)
.function("getFilenames", &csound::System::getFilenames)
.function("getMessageCallback", &csound::System::getMessageCallback)
.function("getMessageLevel", &csound::System::getMessageLevel)
.function("getUserdata", &csound::System::getUserdata)
.function("inform", &csound::System::inform_text)
.function("message", &csound::System::message_text)
.function("parsePathname", &csound::System::parsePathname)
.function("setMessageCallback", &csound::System::setMessageCallback)
.function("setMessageLevel", &csound::System::setMessageLevel)
.function("setUserdata", &csound::System::setUserdata)
.function("warn", &csound::System::warn_text)
;

emscripten::class_<Eigen::VectorXd>("VectorXd")
.constructor<>()
;
Expand Down
2 changes: 1 addition & 1 deletion WebAssembly/examples/CsoundAudioProcessor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/CsoundAudioProcessor.js

Large diffs are not rendered by default.

0 comments on commit 91ae738

Please sign in to comment.