mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 21:58:31 +00:00
build
This commit is contained in:
parent
6691afb9b9
commit
8af4a92fc0
@ -179,14 +179,6 @@ export class State {
|
||||
class Pattern {
|
||||
constructor(query) {
|
||||
this.query = query;
|
||||
const proto = Object.getPrototypeOf(this);
|
||||
proto.patternified.forEach((prop) => {
|
||||
this[prop] = (...args) => this._patternify(Pattern.prototype["_" + prop])(...args);
|
||||
Object.assign(this[prop], Object.fromEntries(Object.entries(Pattern.prototype.factories).map(([type, func]) => [
|
||||
type,
|
||||
(...args) => this[prop](func(...args))
|
||||
])));
|
||||
});
|
||||
}
|
||||
_splitQueries() {
|
||||
const pat = this;
|
||||
@ -735,13 +727,18 @@ Pattern.prototype.define = (name, func, options = {}) => {
|
||||
};
|
||||
Pattern.prototype.define("hush", (pat) => pat.hush(), {patternified: false, composable: true});
|
||||
Pattern.prototype.define("bypass", (pat) => pat.bypass(on), {patternified: true, composable: true});
|
||||
Pattern.prototype.bootstrap = () => {
|
||||
Pattern.prototype.bootstrap = function() {
|
||||
const bootstrapped = Object.fromEntries(Object.entries(Pattern.prototype.composable).map(([functionName, composable]) => {
|
||||
if (Pattern.prototype[functionName]) {
|
||||
Pattern.prototype[functionName] = makeComposable(Pattern.prototype[functionName]);
|
||||
}
|
||||
return [functionName, curry(composable, makeComposable)];
|
||||
}));
|
||||
this.patternified.forEach((prop) => {
|
||||
Pattern.prototype[prop] = function(...args) {
|
||||
return this._patternify(Pattern.prototype["_" + prop])(...args);
|
||||
};
|
||||
});
|
||||
return bootstrapped;
|
||||
};
|
||||
function withLocationOffset(pat, offset) {
|
||||
|
||||
2
docs/dist/tunes.js
vendored
2
docs/dist/tunes.js
vendored
@ -226,7 +226,7 @@ export const magicSofa = `stack(
|
||||
.every(2, fast(2))
|
||||
.voicings(),
|
||||
"<c2 f2 g2> <d2 g2 a2 e2>"
|
||||
).slow(1).transpose.slowcat(0, 2, 3, 4)`;
|
||||
).slow(1).transpose(slowcat(0, 2, 3, 4))`;
|
||||
export const confusedPhone = `"[g2 ~@1.3] [c3 ~@1.3]"
|
||||
.superimpose(
|
||||
transpose(-12).late(0),
|
||||
|
||||
2
docs/dist/useCycle.js
vendored
2
docs/dist/useCycle.js
vendored
@ -34,7 +34,7 @@ function useCycle(props) {
|
||||
};
|
||||
useEffect(() => {
|
||||
ready && query();
|
||||
}, [onEvent, onSchedule, onQuery, ready]);
|
||||
}, [onEvent, onSchedule, onQuery, onDraw, ready]);
|
||||
const start = async () => {
|
||||
setStarted(true);
|
||||
await Tone.start();
|
||||
|
||||
5
docs/dist/useRepl.js
vendored
5
docs/dist/useRepl.js
vendored
@ -47,6 +47,11 @@ function useRepl({tune, defaultSynth, autolink = true, onEvent, onDraw}) {
|
||||
if (_events.length) {
|
||||
}
|
||||
};
|
||||
onDraw = useMemo(() => {
|
||||
if (activeCode && !activeCode.includes("strudel disable-highlighting")) {
|
||||
return onDraw;
|
||||
}
|
||||
}, [activeCode]);
|
||||
const cycle = useCycle({
|
||||
onDraw,
|
||||
onEvent: useCallback((time, event) => {
|
||||
|
||||
@ -41802,6 +41802,12 @@ function useRepl({ tune , defaultSynth , autolink =true , onEvent , onDraw }) {
|
||||
const logCycle = (_events, cycle)=>{
|
||||
_events.length;
|
||||
};
|
||||
// below block allows disabling the highlighting by including "strudel disable-highlighting" in the code (as comment)
|
||||
onDraw = _react.useMemo(()=>{
|
||||
if (activeCode && !activeCode.includes('strudel disable-highlighting')) return onDraw;
|
||||
}, [
|
||||
activeCode
|
||||
]);
|
||||
// cycle hook to control scheduling
|
||||
const cycle1 = _useCycleDefault.default({
|
||||
onDraw,
|
||||
@ -42358,21 +42364,6 @@ class Pattern {
|
||||
// the following functions will get patternFactories as nested functions:
|
||||
constructor(query){
|
||||
this.query = query;
|
||||
// the following code will assign `patternFactories` as child functions to all methods of Pattern that don't start with '_'
|
||||
const proto = Object.getPrototypeOf(this);
|
||||
// proto.patternified is defined below Pattern class. You can add more patternified functions from outside.
|
||||
proto.patternified.forEach((prop)=>{
|
||||
// patternify function
|
||||
this[prop] = (...args)=>this._patternify(Pattern.prototype['_' + prop])(...args)
|
||||
;
|
||||
// with the following, you can do, e.g. `stack(c3).fast.slowcat(1, 2, 4, 8)` instead of `stack(c3).fast(slowcat(1, 2, 4, 8))`
|
||||
Object.assign(this[prop], Object.fromEntries(Object.entries(Pattern.prototype.factories).map(([type, func])=>[
|
||||
type,
|
||||
(...args)=>this[prop](func(...args))
|
||||
,
|
||||
]
|
||||
)));
|
||||
});
|
||||
}
|
||||
_splitQueries() {
|
||||
// Splits queries at cycle boundaries. This makes some calculations
|
||||
@ -43133,7 +43124,7 @@ Pattern.prototype.define('bypass', (pat)=>pat.bypass(on)
|
||||
composable: true
|
||||
});
|
||||
// call this after all Patter.prototype.define calls have been executed! (right before evaluate)
|
||||
Pattern.prototype.bootstrap = ()=>{
|
||||
Pattern.prototype.bootstrap = function() {
|
||||
// makeComposable(Pattern.prototype);
|
||||
const bootstrapped = Object.fromEntries(Object.entries(Pattern.prototype.composable).map(([functionName, composable])=>{
|
||||
if (Pattern.prototype[functionName]) // without this, 'C^7'.m.chordBass.transpose(2) will throw "C^7".m.chordBass.transpose is not a function
|
||||
@ -43143,6 +43134,26 @@ Pattern.prototype.bootstrap = ()=>{
|
||||
curry(composable, makeComposable)
|
||||
];
|
||||
}));
|
||||
// note: this === Pattern.prototypetgh6z
|
||||
this.patternified.forEach((prop)=>{
|
||||
// the following will patternify all functions in Pattern.prototype.patternified
|
||||
Pattern.prototype[prop] = function(...args) {
|
||||
return this._patternify(Pattern.prototype['_' + prop])(...args);
|
||||
};
|
||||
// with the following, you can do, e.g. `stack(c3).fast.slowcat(1, 2, 4, 8)` instead of `stack(c3).fast(slowcat(1, 2, 4, 8))`
|
||||
// TODO: find a way to implement below outside of constructor (code only worked there)
|
||||
/* Object.assign(
|
||||
Pattern.prototype[prop],
|
||||
Object.fromEntries(
|
||||
Object.entries(Pattern.prototype.factories).map(([type, func]) => [
|
||||
type,
|
||||
function(...args) {
|
||||
console.log('this', this);
|
||||
return this[prop](func(...args))
|
||||
}
|
||||
])
|
||||
)
|
||||
); */ });
|
||||
return bootstrapped;
|
||||
};
|
||||
// this is wrapped around mini patterns to offset krill parser location into the global js code space
|
||||
@ -171906,6 +171917,7 @@ function useCycle(props) {
|
||||
onEvent,
|
||||
onSchedule,
|
||||
onQuery,
|
||||
onDraw,
|
||||
ready
|
||||
]);
|
||||
const start = async ()=>{
|
||||
@ -183291,4 +183303,4 @@ exports.default = cx;
|
||||
|
||||
},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}]},["3uVTb"], "3uVTb", "parcelRequire94c2")
|
||||
|
||||
//# sourceMappingURL=index.dd5b0e5b.js.map
|
||||
//# sourceMappingURL=index.f8c9aeff.js.map
|
||||
File diff suppressed because one or more lines are too long
@ -11,6 +11,6 @@
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<script src="/tutorial/index.dd5b0e5b.js" defer=""></script>
|
||||
<script src="/tutorial/index.f8c9aeff.js" defer=""></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user