fix test error

- add mock 'midin' and 'sysex'
- typo in sysex example
This commit is contained in:
nkymut 2025-01-25 01:12:38 +08:00
parent d06a75a2cd
commit 393d17a41b
3 changed files with 81 additions and 2 deletions

View File

@ -1669,7 +1669,7 @@ export const { miditouch } = registerControl('miditouch');
* @param {number | Pattern} id Sysex ID
* @param {number | Pattern} data Sysex data
* @example
* note("c4").sysex("0x77, "0x01:0x02:0x03:0x04").midichan(1).midi()
* note("c4").sysex(["0x77", "0x01:0x02:0x03:0x04"]).midichan(1).midi()
*/
export const sysex = register('sysex', (args, pat) => {
if (!Array.isArray(args)) {

View File

@ -4669,6 +4669,45 @@ exports[`runs examples > example "mask" example index 0 1`] = `
]
`;
exports[`runs examples > example "midi" example index 0 1`] = `
[
"[ 0/1 → 1/1 | note:c4 midichan:1 ]",
"[ 1/1 → 2/1 | note:c4 midichan:1 ]",
"[ 2/1 → 3/1 | note:c4 midichan:1 ]",
"[ 3/1 → 4/1 | note:c4 midichan:1 ]",
]
`;
exports[`runs examples > example "midichan" example index 0 1`] = `
[
"[ 0/1 → 1/1 | note:c4 midichan:1 ]",
"[ 1/1 → 2/1 | note:c4 midichan:1 ]",
"[ 2/1 → 3/1 | note:c4 midichan:1 ]",
"[ 3/1 → 4/1 | note:c4 midichan:1 ]",
]
`;
exports[`runs examples > example "midin" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:c cutoff:0 resonance:0 s:sawtooth ]",
"[ 1/4 → 1/2 | note:a cutoff:0 resonance:0 s:sawtooth ]",
"[ 1/2 → 3/4 | note:f cutoff:0 resonance:0 s:sawtooth ]",
"[ 3/4 → 1/1 | note:e cutoff:0 resonance:0 s:sawtooth ]",
"[ 1/1 → 5/4 | note:c cutoff:0 resonance:0 s:sawtooth ]",
"[ 5/4 → 3/2 | note:a cutoff:0 resonance:0 s:sawtooth ]",
"[ 3/2 → 7/4 | note:f cutoff:0 resonance:0 s:sawtooth ]",
"[ 7/4 → 2/1 | note:e cutoff:0 resonance:0 s:sawtooth ]",
"[ 2/1 → 9/4 | note:c cutoff:0 resonance:0 s:sawtooth ]",
"[ 9/4 → 5/2 | note:a cutoff:0 resonance:0 s:sawtooth ]",
"[ 5/2 → 11/4 | note:f cutoff:0 resonance:0 s:sawtooth ]",
"[ 11/4 → 3/1 | note:e cutoff:0 resonance:0 s:sawtooth ]",
"[ 3/1 → 13/4 | note:c cutoff:0 resonance:0 s:sawtooth ]",
"[ 13/4 → 7/2 | note:a cutoff:0 resonance:0 s:sawtooth ]",
"[ 7/2 → 15/4 | note:f cutoff:0 resonance:0 s:sawtooth ]",
"[ 15/4 → 4/1 | note:e cutoff:0 resonance:0 s:sawtooth ]",
]
`;
exports[`runs examples > example "mousex" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C3 ]",
@ -8285,6 +8324,33 @@ exports[`runs examples > example "swingBy" example index 0 1`] = `
]
`;
exports[`runs examples > example "sysex" example index 0 1`] = `
[
"[ 0/1 → 1/1 | note:c4 sysexid:119 sysexdata:[1 2 3 4] midichan:1 ]",
"[ 1/1 → 2/1 | note:c4 sysexid:119 sysexdata:[1 2 3 4] midichan:1 ]",
"[ 2/1 → 3/1 | note:c4 sysexid:119 sysexdata:[1 2 3 4] midichan:1 ]",
"[ 3/1 → 4/1 | note:c4 sysexid:119 sysexdata:[1 2 3 4] midichan:1 ]",
]
`;
exports[`runs examples > example "sysexdata" example index 0 1`] = `
[
"[ 0/1 → 1/1 | note:c4 sysexid:119 sysexdata:[1 2 3 4] midichan:1 ]",
"[ 1/1 → 2/1 | note:c4 sysexid:119 sysexdata:[1 2 3 4] midichan:1 ]",
"[ 2/1 → 3/1 | note:c4 sysexid:119 sysexdata:[1 2 3 4] midichan:1 ]",
"[ 3/1 → 4/1 | note:c4 sysexid:119 sysexdata:[1 2 3 4] midichan:1 ]",
]
`;
exports[`runs examples > example "sysexid" example index 0 1`] = `
[
"[ 0/1 → 1/1 | note:c4 sysexid:119 sysexdata:[1 2 3 4] midichan:1 ]",
"[ 1/1 → 2/1 | note:c4 sysexid:119 sysexdata:[1 2 3 4] midichan:1 ]",
"[ 2/1 → 3/1 | note:c4 sysexid:119 sysexdata:[1 2 3 4] midichan:1 ]",
"[ 3/1 → 4/1 | note:c4 sysexid:119 sysexdata:[1 2 3 4] midichan:1 ]",
]
`;
exports[`runs examples > example "transpose" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C2 ]",

View File

@ -122,6 +122,10 @@ strudel.Pattern.prototype.midi = function () {
return this;
};
strudel.Pattern.prototype.midin = function () {
return this;
};
strudel.Pattern.prototype._scope = function () {
return this;
};
@ -164,6 +168,12 @@ const loadCsound = () => {};
const loadCSound = () => {};
const loadcsound = () => {};
const midin = () => {
return (ccNum) => strudel.ref(() => 0); // returns ref with default value 0
};
const sysex = ([id, data]) => {};
// TODO: refactor to evalScope
evalScope(
// Tone,
@ -172,6 +182,7 @@ evalScope(
uiHelpersMocked,
webaudio,
tonalHelpers,
/*
toneHelpers,
voicingHelpers,
@ -179,6 +190,8 @@ evalScope(
uiHelpers,
*/
{
midin,
sysex,
// gist,
// euclid,
csound: id,