export pattern.mjs as single object

This commit is contained in:
alex
2022-12-05 11:33:40 +00:00
parent 5ec217ea21
commit 274378df42
30 changed files with 175 additions and 121 deletions
+2 -1
View File
@@ -4,7 +4,7 @@ Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/st
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { cleanupDraw, cleanupUi, controls, evalScope, logger } from '@strudel.cycles/core';
import { cleanupDraw, cleanupUi, controls, evalScope, logger, pattern } from '@strudel.cycles/core';
import { CodeMirror, cx, flash, useHighlighting, useStrudel } from '@strudel.cycles/react';
import {
getAudioContext,
@@ -47,6 +47,7 @@ const modules = [
evalScope(
// Tone,
controls, // sadly, this cannot be exported from core direclty
pattern,
{ WebDirt },
...modules,
);
+2 -1
View File
@@ -1,4 +1,5 @@
import { Pattern, toMidi } from '@strudel.cycles/core';
import { pattern, toMidi } from '@strudel.cycles/core';
const { Pattern } = pattern;
import { samples } from '@strudel.cycles/webaudio';
export async function prebake({ isMock = false, baseDir = '.' } = {}) {
+15 -13
View File
@@ -7,6 +7,7 @@
import { evaluate } from '@strudel.cycles/transpiler';
import { evalScope } from '@strudel.cycles/core';
import * as strudel from '@strudel.cycles/core';
const { Pattern } = strudel.pattern;
import * as webaudio from '@strudel.cycles/webaudio';
import controls from '@strudel.cycles/core/controls.mjs';
// import gist from '@strudel.cycles/core/gist.js';
@@ -85,48 +86,48 @@ const toneHelpersMocked = {
highpass: mockNode,
};
strudel.Pattern.prototype.osc = function () {
Pattern.prototype.osc = function () {
return this;
};
strudel.Pattern.prototype.tone = function () {
Pattern.prototype.tone = function () {
return this;
};
strudel.Pattern.prototype.webdirt = function () {
Pattern.prototype.webdirt = function () {
return this;
};
// draw mock
strudel.Pattern.prototype.pianoroll = function () {
Pattern.prototype.pianoroll = function () {
return this;
};
// speak mock
strudel.Pattern.prototype.speak = function () {
Pattern.prototype.speak = function () {
return this;
};
// webaudio mock
strudel.Pattern.prototype.wave = function () {
Pattern.prototype.wave = function () {
return this;
};
strudel.Pattern.prototype.filter = function () {
Pattern.prototype.filter = function () {
return this;
};
strudel.Pattern.prototype.adsr = function () {
Pattern.prototype.adsr = function () {
return this;
};
strudel.Pattern.prototype.out = function () {
Pattern.prototype.out = function () {
return this;
};
strudel.Pattern.prototype.soundfont = function () {
Pattern.prototype.soundfont = function () {
return this;
};
// tune mock
strudel.Pattern.prototype.tune = function () {
Pattern.prototype.tune = function () {
return this;
};
strudel.Pattern.prototype.midi = function () {
Pattern.prototype.midi = function () {
return this;
};
@@ -156,7 +157,8 @@ const loadSoundfont = () => {};
evalScope(
// Tone,
strudel,
strudel.Pattern.prototype.bootstrap(),
strudel.pattern,
Pattern.prototype.bootstrap(),
toneHelpersMocked,
uiHelpersMocked,
controls,