Skip to content
This repository was archived by the owner on Apr 5, 2025. It is now read-only.

Commit 91ae738

Browse files
committed
1 parent 0ffb11d commit 91ae738

File tree

5 files changed

+118
-4
lines changed

5 files changed

+118
-4
lines changed

CsoundAC/Cell.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ class SILENCE_PUBLIC Stack :
136136
* first (0th) node.
137137
*/
138138
double duration;
139+
virtual double getDuration() const {
140+
return duration;
141+
}
142+
virtual double setDuration(double value) {
143+
duration = value;
144+
}
139145
Stack();
140146
virtual ~Stack();
141147
virtual void traverse(const Eigen::MatrixXd &globalCoordinates,

CsoundAC/System.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,21 @@ class SILENCE_PUBLIC System
267267
* Make some sort of noticeable sound.
268268
*/
269269
static void beep();
270+
static void message_text(std::string text) {
271+
message(text.c_str());
272+
}
273+
static void debug_text(std::string text) {
274+
debug(text.c_str());
275+
}
276+
static void inform_text(std::string text) {
277+
inform(text.c_str());
278+
}
279+
static void warn_text(std::string text) {
280+
warn(text.c_str());
281+
}
282+
static void error_text(std::string text) {
283+
error(text.c_str());
284+
}
270285
};
271286

272287
/**

WebAssembly/CsoundAC/csoundac_embind.cpp

Lines changed: 95 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,9 +720,10 @@ EMSCRIPTEN_BINDINGS(csoundac) {
720720
.function("transpose_degrees", &csound::Scale::transpose_degrees)
721721
.function("transpose_to_degree", &csound::Scale::transpose_to_degree)
722722
;
723+
// FINISHED
723724
emscripten::class_<csound::Score>("Score")
724725
.constructor<>()
725-
.function("append_note", &csound::Score::append_note)
726+
.function("append", &csound::Score::append_note)
726727
.function("append_event", &csound::Score::append_event)
727728
.function("arrange_all", &csound::Score::arrange_all)
728729
.function("getCsoundScore", &csound::Score::getCsoundScore)
@@ -764,12 +765,104 @@ EMSCRIPTEN_BINDINGS(csoundac) {
764765
.function("voicelead", &csound::Score::voicelead_segments)
765766
.function("voicelead_pitches", &csound::Score::voicelead_pitches)
766767
.function("setPTV", &csound::Score::setPTV)
767-
;
768+
;
769+
// FINISHED
770+
emscripten::class_<csound::ScoreModel, emscripten::base<csound::Composition> >("ScoreModel")
771+
.constructor<>()
772+
// Repeating Node methods here to make up for lack of multiple inheritance.
773+
.function("addChild", &csound::ScoreModel::addChild, emscripten::allow_raw_pointers())
774+
.function("childCount", &csound::ScoreModel::childCount)
775+
.function("clear", &csound::ScoreModel::clear)
776+
.function("createTransform", &csound::ScoreModel::createTransform)
777+
.function("element", &csound::ScoreModel::element)
778+
.function("generate", &csound::ScoreModel::generate)
779+
.function("getChild", &csound::ScoreModel::getChild, emscripten::allow_raw_pointers())
780+
.function("getLocalCoordinates", &csound::ScoreModel::getLocalCoordinates)
781+
.function("setElement", &csound::ScoreModel::setElement)
782+
.function("transform", &csound::ScoreModel::transform)
783+
.function("traverse", &csound::ScoreModel::traverse)
784+
// End of Node methods.
785+
.function("getThisNode", &csound::ScoreModel::getThisNode, emscripten::allow_raw_pointers())
786+
.function("initialize", &csound::ScoreModel::initialize)
787+
;
768788
// FINISHED
769789
emscripten::class_<csound::ScoreNode, emscripten::base<csound::Node> >("ScoreNode")
770790
.constructor<>()
771791
.function("getScore", &csound::ScoreNode::getScore, emscripten::allow_raw_pointers())
772792
;
793+
// FINISHED
794+
emscripten::class_<csound::Sequence, emscripten::base<csound::Node> >("Sequence")
795+
.constructor<>()
796+
;
797+
// FINISHED
798+
emscripten::class_<csound::Stack, emscripten::base<csound::ScoreNode> >("Stack")
799+
.constructor<>()
800+
.property("duration", &csound::Stack::getDuration, &csound::Stack::setDuration)
801+
;
802+
// FINISHED
803+
emscripten::class_<csound::StrangeAttractor, emscripten::base<csound::ScoreNode> >("StrangeAttractor")
804+
.constructor<>()
805+
.function("calculateFractalDimension", &csound::StrangeAttractor::calculateFractalDimension)
806+
.function("calculateLyupanovExponent", &csound::StrangeAttractor::calculateLyupanovExponent)
807+
.function("codeRandomize", &csound::StrangeAttractor::codeRandomize)
808+
.function("evaluateAttractor", &csound::StrangeAttractor::evaluateAttractor)
809+
.function("getAttractorType", &csound::StrangeAttractor::getAttractorType)
810+
.function("getCode", &csound::StrangeAttractor::getCode)
811+
.function("getCoefficients", &csound::StrangeAttractor::getCoefficients)
812+
.function("getDimensionAndOrder", &csound::StrangeAttractor::getDimensionAndOrder)
813+
.function("getDimensionCount", &csound::StrangeAttractor::getDimensionCount)
814+
.function("getFractalDimension", &csound::StrangeAttractor::getFractalDimension)
815+
.function("getIteration", &csound::StrangeAttractor::getIteration)
816+
.function("getIterationCount", &csound::StrangeAttractor::getIterationCount)
817+
.function("getLyupanovExponent", &csound::StrangeAttractor::getLyupanovExponent)
818+
.function("getScoreType", &csound::StrangeAttractor::getScoreType)
819+
.function("getW", &csound::StrangeAttractor::getW)
820+
.function("getX", &csound::StrangeAttractor::getX)
821+
.function("getY", &csound::StrangeAttractor::getY)
822+
.function("getZ", &csound::StrangeAttractor::getZ)
823+
.function("initialize", &csound::StrangeAttractor::initialize)
824+
.function("iterate", &csound::StrangeAttractor::iterate)
825+
.function("reinitialize", &csound::StrangeAttractor::reinitialize)
826+
.function("render", &csound::StrangeAttractor::render)
827+
.function("reset", &csound::StrangeAttractor::reset)
828+
.function("searchForAttractor", &csound::StrangeAttractor::searchForAttractor)
829+
.function("setAttractorType", &csound::StrangeAttractor::setAttractorType)
830+
.function("setCode", &csound::StrangeAttractor::setCode)
831+
.function("setDimensionCount", &csound::StrangeAttractor::setDimensionCount)
832+
.function("setIteration", &csound::StrangeAttractor::setIteration)
833+
.function("setIterationCount", &csound::StrangeAttractor::setIterationCount)
834+
.function("setScoreType", &csound::StrangeAttractor::setScoreType)
835+
.function("setAttractorType", &csound::StrangeAttractor::setAttractorType)
836+
.function("setAttractorType", &csound::StrangeAttractor::setAttractorType)
837+
.function("setW", &csound::StrangeAttractor::setW)
838+
.function("setX", &csound::StrangeAttractor::setX)
839+
.function("setY", &csound::StrangeAttractor::setY)
840+
.function("setZ", &csound::StrangeAttractor::setZ)
841+
.function("shuffleRandomNumbers", &csound::StrangeAttractor::shuffleRandomNumbers)
842+
.function("specialFunctions", &csound::StrangeAttractor::specialFunctions)
843+
;
844+
// FINISHED
845+
// Mostly not supported and not used, much else simplified.
846+
emscripten::class_<csound::System>("System")
847+
.constructor<>()
848+
.function("beep", &csound::System::beep)
849+
.function("debug", &csound::System::debug_text)
850+
.function("error", &csound::System::error_text)
851+
.function("execute", &csound::System::execute)
852+
.function("getDirectoryNames", &csound::System::getDirectoryNames)
853+
.function("getFilenames", &csound::System::getFilenames)
854+
.function("getMessageCallback", &csound::System::getMessageCallback)
855+
.function("getMessageLevel", &csound::System::getMessageLevel)
856+
.function("getUserdata", &csound::System::getUserdata)
857+
.function("inform", &csound::System::inform_text)
858+
.function("message", &csound::System::message_text)
859+
.function("parsePathname", &csound::System::parsePathname)
860+
.function("setMessageCallback", &csound::System::setMessageCallback)
861+
.function("setMessageLevel", &csound::System::setMessageLevel)
862+
.function("setUserdata", &csound::System::setUserdata)
863+
.function("warn", &csound::System::warn_text)
864+
;
865+
773866
emscripten::class_<Eigen::VectorXd>("VectorXd")
774867
.constructor<>()
775868
;

WebAssembly/examples/CsoundAudioProcessor.js

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/CsoundAudioProcessor.js

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)