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

Commit a27f42b

Browse files
committed
1 parent 582c4ab commit a27f42b

File tree

7 files changed

+120
-8
lines changed

7 files changed

+120
-8
lines changed

CsoundAC/ChordSpace.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3484,7 +3484,7 @@ class SILENCE_PUBLIC ChordSpaceGroup {
34843484
}
34853485
return result;
34863486
}
3487-
std::vector<Chord> toChord(const Eigen::VectorXi &pitv, bool printme = false) const {
3487+
std::vector<Chord> toChord_vector(const Eigen::VectorXi &pitv, bool printme = false) const {
34883488
return toChord(pitv(0), pitv(1), pitv(2), pitv(3), printme);
34893489
}
34903490
};

CsoundAC/Event.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ double Event::getGain() const
324324
return Conversions::midiToGain(getVelocity());
325325
}
326326

327-
double Event::getKey(double tonesPerOctave) const
327+
double Event::getKey_tempered(double tonesPerOctave) const
328328
{
329329
if(tonesPerOctave == 0.0)
330330
{
@@ -372,7 +372,7 @@ std::string Event::toCsoundIStatement(double tonesPerOctave) const
372372
getInstrument(),
373373
getTime(),
374374
getDuration(),
375-
getKey(tonesPerOctave),
375+
getKey_tempered(tonesPerOctave),
376376
getVelocity(),
377377
getDepth(),
378378
getPan(),

CsoundAC/Event.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class SILENCE_PUBLIC Event :
138138
virtual void setOffTime(double offTime);
139139
virtual int getKeyNumber() const;
140140
virtual double getKey() const;
141-
virtual double getKey(double tonesPerOctave) const;
141+
virtual double getKey_tempered(double tonesPerOctave) const;
142142
virtual void setKey(double key);
143143
virtual double getFrequency() const;
144144
virtual void setFrequency(double frequency);

CsoundAC/Score.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ std::vector<double> Score::getPitches(size_t begin_, size_t end_, size_t divisio
681681
std::vector<double> chord;
682682
for (size_t i = begin_; i < end_; i++) {
683683
const Event &event = (*this)[i];
684-
double pitch = event.getKey(divisionsPerOctave_);
684+
double pitch = event.getKey_tempered(divisionsPerOctave_);
685685
if (pitches.find(pitch) == pitches.end()) {
686686
pitches.insert(pitch);
687687
chord.push_back(pitch);

WebAssembly/CsoundAC/csoundac_embind.cpp

Lines changed: 113 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ EMSCRIPTEN_BINDINGS(csoundac) {
170170
emscripten::function("transpose_degrees", &csound::transpose_degrees);
171171
emscripten::register_vector<csound::Chord>("ChordVector");
172172
emscripten::register_vector<csound::Scale>("ScaleVector");
173+
emscripten::register_vector<double>("DoubleVector");
174+
emscripten::register_map<std::string,std::string>("StringToStringMap");
173175
emscripten::class_<csound::Chord>("Chord")
174176
.constructor<>()
175177
.constructor<csound::Chord>()
@@ -271,8 +273,118 @@ EMSCRIPTEN_BINDINGS(csoundac) {
271273
.function("voiceleading", &csound::Chord::voiceleading)
272274
.function("voices", &csound::Chord::voices)
273275
;
276+
// FINISHED
277+
emscripten::class_<csound::ChordLindenmayer, emscripten::base<csound::VoiceleadingNode> >("ChordLindenmayer")
278+
.constructor<>()
279+
.function("addRule", &csound::ChordLindenmayer::addRule)
280+
.function("createRotation", &csound::ChordLindenmayer::createRotation)
281+
// Can't do this by returning in a reference argument.
282+
// .function("equivalence", &csound::ChordLindenmayer::equivalence)
283+
.function("fixStatus", &csound::ChordLindenmayer::fixStatus)
284+
.function("generateLindenmayerSystem", &csound::ChordLindenmayer::generateLindenmayerSystem)
285+
.function("getAngle", &csound::ChordLindenmayer::getAngle)
286+
.function("getAxiom", &csound::ChordLindenmayer::getAxiom)
287+
.function("getDimension", &csound::ChordLindenmayer::getDimension)
288+
.function("getIterationCount", &csound::ChordLindenmayer::getIterationCount)
289+
.function("getReplacement", &csound::ChordLindenmayer::getReplacement)
290+
.function("initialize", &csound::ChordLindenmayer::initialize)
291+
.function("interpret", &csound::ChordLindenmayer::interpret)
292+
// Can't do this by returning a value in a reference argument.
293+
// .function("parseCommand", &csound::ChordLindenmayer::parseCommand)
294+
.function("setAngle", &csound::ChordLindenmayer::setAngle)
295+
.function("setAxiom", &csound::ChordLindenmayer::setAxiom)
296+
.function("setIterationCount", &csound::ChordLindenmayer::setIterationCount)
297+
.function("tieOverlappingNotes", &csound::ChordLindenmayer::tieOverlappingNotes)
298+
.function("writeScore", &csound::ChordLindenmayer::writeScore)
299+
;
300+
// FINISHED
301+
emscripten::class_<csound::ChordScore, emscripten::base<csound::Score> >("ChordScore")
302+
.constructor<>()
303+
.function("conformToChords", &csound::ChordScore::conformToChords)
304+
.function("getChord", &csound::ChordScore::getChord, emscripten::allow_raw_pointers())
305+
.function("insertChord", &csound::ChordScore::insertChord)
306+
;
307+
emscripten::class_<csound::ChordSpaceGroup>("ChordSpaceGroup")
308+
.constructor<>()
309+
.function("createChordSpaceGroup", &csound::ChordSpaceGroup::createChordSpaceGroup)
310+
.function("createFilename", &csound::ChordSpaceGroup::createFilename)
311+
.function("fromChord", &csound::ChordSpaceGroup::fromChord)
312+
.function("initialize", &csound::ChordSpaceGroup::initialize)
313+
.function("list", &csound::ChordSpaceGroup::list)
314+
.function("load", &csound::ChordSpaceGroup::load)
315+
.function("preinitialize", &csound::ChordSpaceGroup::preinitialize)
316+
.function("save", &csound::ChordSpaceGroup::save)
317+
.function("toChord", &csound::ChordSpaceGroup::toChord)
318+
;
319+
// FINISHED
320+
emscripten::function("operator<", emscripten::select_overload<bool(const csound::Event&,const csound::Event&)>(&csound::operator<));
274321
emscripten::class_<csound::Event, emscripten::base<Eigen::VectorXd> >("Event")
275322
.constructor<>()
323+
.constructor<const csound::Event&>()
324+
.constructor<std::string>()
325+
.constructor<const Eigen::VectorXd&>()
326+
.constructor<double, double, double, double, double, double, double, double, double, double, double>()
327+
.constructor<std::vector<double> >()
328+
.function("clearProperties", &csound::Event::clearProperties)
329+
.function("conformToPitchClassSet", &csound::Event::conformToPitchClassSet)
330+
.function("createNoteOffEvent", &csound::Event::createNoteOffEvent)
331+
.function("dump", &csound::Event::dump)
332+
.function("getAmplitude", &csound::Event::getAmplitude)
333+
.function("getChannel", &csound::Event::getChannel)
334+
.function("getDepth", &csound::Event::getDepth)
335+
.function("getDuration", &csound::Event::getDuration)
336+
.function("getFrequency", &csound::Event::getFrequency)
337+
.function("getGain", &csound::Event::getGain)
338+
.function("getHeight", &csound::Event::getHeight)
339+
.function("getInstrument", &csound::Event::getInstrument)
340+
.function("getKey", &csound::Event::getKey)
341+
.function("getKey_tempered", &csound::Event::getKey_tempered)
342+
.function("getKeyNumber", &csound::Event::getKeyNumber)
343+
.function("getLeftGain", &csound::Event::getLeftGain)
344+
.function("getMidiStatus", &csound::Event::getMidiStatus)
345+
.function("getKeyNumber", &csound::Event::getKeyNumber)
346+
.function("getOffTime", &csound::Event::getOffTime)
347+
.function("getPan", &csound::Event::getPan)
348+
.function("getPhase", &csound::Event::getPhase)
349+
.function("getPitches", &csound::Event::getPitches)
350+
.function("getProperties", &csound::Event::getProperties)
351+
.function("getProperty", &csound::Event::getProperty)
352+
.function("getRightGain", &csound::Event::getRightGain)
353+
.function("getStatus", &csound::Event::getStatus)
354+
.function("getStatusNumber", &csound::Event::getStatusNumber)
355+
.function("getTime", &csound::Event::getTime)
356+
.function("getVelocity", &csound::Event::getVelocity)
357+
.function("getVelocityNumber", &csound::Event::getVelocityNumber)
358+
.function("initialize", &csound::Event::initialize)
359+
.function("isMatchingEvent", &csound::Event::isMatchingEvent)
360+
.function("isMatchingNoteOff", &csound::Event::isMatchingNoteOff)
361+
.function("isMidiEvent", &csound::Event::isMidiEvent)
362+
.function("isNote", &csound::Event::isNote)
363+
.function("isNoteOff", &csound::Event::isNoteOff)
364+
.function("isNoteOn", &csound::Event::isNoteOn)
365+
.function("operator=", emscripten::select_overload<csound::Event&(const csound::Event&)>(&csound::Event::operator=))
366+
.function("removeProperty", &csound::Event::removeProperty)
367+
.function("set", &csound::Event::set)
368+
.function("setAmplitude", &csound::Event::setAmplitude)
369+
.function("setDepth", &csound::Event::setDepth)
370+
.function("setDuration", &csound::Event::setDuration)
371+
.function("setFrequency", &csound::Event::setFrequency)
372+
.function("setHeight", &csound::Event::setHeight)
373+
.function("setInstrument", &csound::Event::setInstrument)
374+
.function("setKey", &csound::Event::setKey)
375+
.function("setOffTime", &csound::Event::setOffTime)
376+
.function("setPan", &csound::Event::setPan)
377+
.function("setPhase", &csound::Event::setPhase)
378+
.function("setPitches", &csound::Event::setPitches)
379+
.function("setProperty", &csound::Event::setProperty)
380+
.function("setStatus", &csound::Event::setStatus)
381+
.function("setTime", &csound::Event::setTime)
382+
.function("setVelocity", &csound::Event::setVelocity)
383+
.function("temper", &csound::Event::temper)
384+
.function("toCsoundIStatement", &csound::Event::toCsoundIStatement)
385+
.function("toCsoundIStatementHeld", &csound::Event::toCsoundIStatementHeld)
386+
.function("toCsoundIStatementRelease", &csound::Event::toCsoundIStatementRelease)
387+
.function("toString", &csound::Event::toString)
276388
;
277389
emscripten::function("hello", &hello);
278390
// FINISHED
@@ -309,7 +421,7 @@ EMSCRIPTEN_BINDINGS(csoundac) {
309421
.function("modulations", &csound::Scale::modulations)
310422
.function("modulations_for_scale_types", &csound::Scale::modulations_for_scale_types)
311423
.function("relative_tonicizations", &csound::Scale::relative_tonicizations)
312-
.function("relative_tonicizations_for_scale_types", &csound::Scale::relative_tonicizations_for_scale_types)
424+
.function("relative_tonicizations_for_scale_types", &csound::Scale::relative_tonicizations_for_scale_types)
313425
.function("secondary", &csound::Scale::secondary)
314426
.function("semitones_for_degree", &csound::Scale::semitones_for_degree)
315427
.function("tonic", &csound::Scale::tonic)

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)