Add GamePad Module

This commit is contained in:
nkymut 2024-11-27 01:03:09 +08:00
parent 726abf76ce
commit d741b4d17a
9 changed files with 726 additions and 1 deletions

View file

@ -565,6 +565,69 @@ exports[`runs examples > example "_euclidRot" example index 20 1`] = `
]
`;
exports[`runs examples > example "absoluteOrientationAlpha" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C3 ]",
"[ 1/4 → 1/2 | note:C3 ]",
"[ 1/2 → 3/4 | note:C3 ]",
"[ 3/4 → 1/1 | note:C3 ]",
"[ 1/1 → 5/4 | note:C3 ]",
"[ 5/4 → 3/2 | note:C3 ]",
"[ 3/2 → 7/4 | note:C3 ]",
"[ 7/4 → 2/1 | note:C3 ]",
"[ 2/1 → 9/4 | note:C3 ]",
"[ 9/4 → 5/2 | note:C3 ]",
"[ 5/2 → 11/4 | note:C3 ]",
"[ 11/4 → 3/1 | note:C3 ]",
"[ 3/1 → 13/4 | note:C3 ]",
"[ 13/4 → 7/2 | note:C3 ]",
"[ 7/2 → 15/4 | note:C3 ]",
"[ 15/4 → 4/1 | note:C3 ]",
]
`;
exports[`runs examples > example "absoluteOrientationBeta" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C3 ]",
"[ 1/4 → 1/2 | note:C3 ]",
"[ 1/2 → 3/4 | note:C3 ]",
"[ 3/4 → 1/1 | note:C3 ]",
"[ 1/1 → 5/4 | note:C3 ]",
"[ 5/4 → 3/2 | note:C3 ]",
"[ 3/2 → 7/4 | note:C3 ]",
"[ 7/4 → 2/1 | note:C3 ]",
"[ 2/1 → 9/4 | note:C3 ]",
"[ 9/4 → 5/2 | note:C3 ]",
"[ 5/2 → 11/4 | note:C3 ]",
"[ 11/4 → 3/1 | note:C3 ]",
"[ 3/1 → 13/4 | note:C3 ]",
"[ 13/4 → 7/2 | note:C3 ]",
"[ 7/2 → 15/4 | note:C3 ]",
"[ 15/4 → 4/1 | note:C3 ]",
]
`;
exports[`runs examples > example "absoluteOrientationGamma" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C3 ]",
"[ 1/4 → 1/2 | note:C3 ]",
"[ 1/2 → 3/4 | note:C3 ]",
"[ 3/4 → 1/1 | note:C3 ]",
"[ 1/1 → 5/4 | note:C3 ]",
"[ 5/4 → 3/2 | note:C3 ]",
"[ 3/2 → 7/4 | note:C3 ]",
"[ 7/4 → 2/1 | note:C3 ]",
"[ 2/1 → 9/4 | note:C3 ]",
"[ 9/4 → 5/2 | note:C3 ]",
"[ 5/2 → 11/4 | note:C3 ]",
"[ 11/4 → 3/1 | note:C3 ]",
"[ 3/1 → 13/4 | note:C3 ]",
"[ 13/4 → 7/2 | note:C3 ]",
"[ 7/2 → 15/4 | note:C3 ]",
"[ 15/4 → 4/1 | note:C3 ]",
]
`;
exports[`runs examples > example "accelerate" example index 0 1`] = `
[
"[ 0/1 → 2/1 | s:sax accelerate:0 ]",
@ -572,6 +635,69 @@ exports[`runs examples > example "accelerate" example index 0 1`] = `
]
`;
exports[`runs examples > example "accelerationX" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C3 ]",
"[ 1/4 → 1/2 | note:C3 ]",
"[ 1/2 → 3/4 | note:C3 ]",
"[ 3/4 → 1/1 | note:C3 ]",
"[ 1/1 → 5/4 | note:C3 ]",
"[ 5/4 → 3/2 | note:C3 ]",
"[ 3/2 → 7/4 | note:C3 ]",
"[ 7/4 → 2/1 | note:C3 ]",
"[ 2/1 → 9/4 | note:C3 ]",
"[ 9/4 → 5/2 | note:C3 ]",
"[ 5/2 → 11/4 | note:C3 ]",
"[ 11/4 → 3/1 | note:C3 ]",
"[ 3/1 → 13/4 | note:C3 ]",
"[ 13/4 → 7/2 | note:C3 ]",
"[ 7/2 → 15/4 | note:C3 ]",
"[ 15/4 → 4/1 | note:C3 ]",
]
`;
exports[`runs examples > example "accelerationY" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C3 ]",
"[ 1/4 → 1/2 | note:C3 ]",
"[ 1/2 → 3/4 | note:C3 ]",
"[ 3/4 → 1/1 | note:C3 ]",
"[ 1/1 → 5/4 | note:C3 ]",
"[ 5/4 → 3/2 | note:C3 ]",
"[ 3/2 → 7/4 | note:C3 ]",
"[ 7/4 → 2/1 | note:C3 ]",
"[ 2/1 → 9/4 | note:C3 ]",
"[ 9/4 → 5/2 | note:C3 ]",
"[ 5/2 → 11/4 | note:C3 ]",
"[ 11/4 → 3/1 | note:C3 ]",
"[ 3/1 → 13/4 | note:C3 ]",
"[ 13/4 → 7/2 | note:C3 ]",
"[ 7/2 → 15/4 | note:C3 ]",
"[ 15/4 → 4/1 | note:C3 ]",
]
`;
exports[`runs examples > example "accelerationZ" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C3 ]",
"[ 1/4 → 1/2 | note:C3 ]",
"[ 1/2 → 3/4 | note:C3 ]",
"[ 3/4 → 1/1 | note:C3 ]",
"[ 1/1 → 5/4 | note:C3 ]",
"[ 5/4 → 3/2 | note:C3 ]",
"[ 3/2 → 7/4 | note:C3 ]",
"[ 7/4 → 2/1 | note:C3 ]",
"[ 2/1 → 9/4 | note:C3 ]",
"[ 9/4 → 5/2 | note:C3 ]",
"[ 5/2 → 11/4 | note:C3 ]",
"[ 11/4 → 3/1 | note:C3 ]",
"[ 3/1 → 13/4 | note:C3 ]",
"[ 13/4 → 7/2 | note:C3 ]",
"[ 7/2 → 15/4 | note:C3 ]",
"[ 15/4 → 4/1 | note:C3 ]",
]
`;
exports[`runs examples > example "add" example index 0 1`] = `
[
"[ 0/1 → 1/3 | note:C3 ]",
@ -742,6 +868,8 @@ exports[`runs examples > example "almostNever" example index 0 1`] = `
]
`;
exports[`runs examples > example "altitude" example index 0 1`] = `[]`;
exports[`runs examples > example "always" example index 0 1`] = `
[
"[ 0/1 → 1/8 | s:hh speed:0.5 ]",
@ -3337,6 +3465,75 @@ exports[`runs examples > example "gain" example index 0 1`] = `
exports[`runs examples > example "gap" example index 0 1`] = `[]`;
exports[`runs examples > example "geoHeading" example index 0 1`] = `[]`;
exports[`runs examples > example "geoSpeed" example index 0 1`] = `[]`;
exports[`runs examples > example "gravityX" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C3 ]",
"[ 1/4 → 1/2 | note:C3 ]",
"[ 1/2 → 3/4 | note:C3 ]",
"[ 3/4 → 1/1 | note:C3 ]",
"[ 1/1 → 5/4 | note:C3 ]",
"[ 5/4 → 3/2 | note:C3 ]",
"[ 3/2 → 7/4 | note:C3 ]",
"[ 7/4 → 2/1 | note:C3 ]",
"[ 2/1 → 9/4 | note:C3 ]",
"[ 9/4 → 5/2 | note:C3 ]",
"[ 5/2 → 11/4 | note:C3 ]",
"[ 11/4 → 3/1 | note:C3 ]",
"[ 3/1 → 13/4 | note:C3 ]",
"[ 13/4 → 7/2 | note:C3 ]",
"[ 7/2 → 15/4 | note:C3 ]",
"[ 15/4 → 4/1 | note:C3 ]",
]
`;
exports[`runs examples > example "gravityY" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C3 ]",
"[ 1/4 → 1/2 | note:C3 ]",
"[ 1/2 → 3/4 | note:C3 ]",
"[ 3/4 → 1/1 | note:C3 ]",
"[ 1/1 → 5/4 | note:C3 ]",
"[ 5/4 → 3/2 | note:C3 ]",
"[ 3/2 → 7/4 | note:C3 ]",
"[ 7/4 → 2/1 | note:C3 ]",
"[ 2/1 → 9/4 | note:C3 ]",
"[ 9/4 → 5/2 | note:C3 ]",
"[ 5/2 → 11/4 | note:C3 ]",
"[ 11/4 → 3/1 | note:C3 ]",
"[ 3/1 → 13/4 | note:C3 ]",
"[ 13/4 → 7/2 | note:C3 ]",
"[ 7/2 → 15/4 | note:C3 ]",
"[ 15/4 → 4/1 | note:C3 ]",
]
`;
exports[`runs examples > example "gravityZ" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C3 ]",
"[ 1/4 → 1/2 | note:C3 ]",
"[ 1/2 → 3/4 | note:C3 ]",
"[ 3/4 → 1/1 | note:C3 ]",
"[ 1/1 → 5/4 | note:C3 ]",
"[ 5/4 → 3/2 | note:C3 ]",
"[ 3/2 → 7/4 | note:C3 ]",
"[ 7/4 → 2/1 | note:C3 ]",
"[ 2/1 → 9/4 | note:C3 ]",
"[ 9/4 → 5/2 | note:C3 ]",
"[ 5/2 → 11/4 | note:C3 ]",
"[ 11/4 → 3/1 | note:C3 ]",
"[ 3/1 → 13/4 | note:C3 ]",
"[ 13/4 → 7/2 | note:C3 ]",
"[ 7/2 → 15/4 | note:C3 ]",
"[ 15/4 → 4/1 | note:C3 ]",
]
`;
exports[`runs examples > example "heading" example index 0 1`] = `[]`;
exports[`runs examples > example "hpattack" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:c2 s:sawtooth hcutoff:500 hpattack:0.5 hpenv:4 ]",
@ -4099,6 +4296,8 @@ exports[`runs examples > example "late" example index 0 1`] = `
]
`;
exports[`runs examples > example "latitude" example index 0 1`] = `[]`;
exports[`runs examples > example "layer" example index 0 1`] = `
[
"[ 0/1 → 1/8 | note:C3 ]",
@ -4202,6 +4401,8 @@ exports[`runs examples > example "linger" example index 0 1`] = `
]
`;
exports[`runs examples > example "longitude" example index 0 1`] = `[]`;
exports[`runs examples > example "loop" example index 0 1`] = `
[
"[ 0/1 → 1/1 | s:casio loop:1 ]",
@ -4939,6 +5140,69 @@ exports[`runs examples > example "orbit" example index 0 1`] = `
]
`;
exports[`runs examples > example "orientationAlpha" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C3 ]",
"[ 1/4 → 1/2 | note:C3 ]",
"[ 1/2 → 3/4 | note:C3 ]",
"[ 3/4 → 1/1 | note:C3 ]",
"[ 1/1 → 5/4 | note:C3 ]",
"[ 5/4 → 3/2 | note:C3 ]",
"[ 3/2 → 7/4 | note:C3 ]",
"[ 7/4 → 2/1 | note:C3 ]",
"[ 2/1 → 9/4 | note:C3 ]",
"[ 9/4 → 5/2 | note:C3 ]",
"[ 5/2 → 11/4 | note:C3 ]",
"[ 11/4 → 3/1 | note:C3 ]",
"[ 3/1 → 13/4 | note:C3 ]",
"[ 13/4 → 7/2 | note:C3 ]",
"[ 7/2 → 15/4 | note:C3 ]",
"[ 15/4 → 4/1 | note:C3 ]",
]
`;
exports[`runs examples > example "orientationBeta" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C3 ]",
"[ 1/4 → 1/2 | note:C3 ]",
"[ 1/2 → 3/4 | note:C3 ]",
"[ 3/4 → 1/1 | note:C3 ]",
"[ 1/1 → 5/4 | note:C3 ]",
"[ 5/4 → 3/2 | note:C3 ]",
"[ 3/2 → 7/4 | note:C3 ]",
"[ 7/4 → 2/1 | note:C3 ]",
"[ 2/1 → 9/4 | note:C3 ]",
"[ 9/4 → 5/2 | note:C3 ]",
"[ 5/2 → 11/4 | note:C3 ]",
"[ 11/4 → 3/1 | note:C3 ]",
"[ 3/1 → 13/4 | note:C3 ]",
"[ 13/4 → 7/2 | note:C3 ]",
"[ 7/2 → 15/4 | note:C3 ]",
"[ 15/4 → 4/1 | note:C3 ]",
]
`;
exports[`runs examples > example "orientationGamma" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C3 ]",
"[ 1/4 → 1/2 | note:C3 ]",
"[ 1/2 → 3/4 | note:C3 ]",
"[ 3/4 → 1/1 | note:C3 ]",
"[ 1/1 → 5/4 | note:C3 ]",
"[ 5/4 → 3/2 | note:C3 ]",
"[ 3/2 → 7/4 | note:C3 ]",
"[ 7/4 → 2/1 | note:C3 ]",
"[ 2/1 → 9/4 | note:C3 ]",
"[ 9/4 → 5/2 | note:C3 ]",
"[ 5/2 → 11/4 | note:C3 ]",
"[ 11/4 → 3/1 | note:C3 ]",
"[ 3/1 → 13/4 | note:C3 ]",
"[ 13/4 → 7/2 | note:C3 ]",
"[ 7/2 → 15/4 | note:C3 ]",
"[ 15/4 → 4/1 | note:C3 ]",
]
`;
exports[`runs examples > example "outside" example index 0 1`] = `
[
"[ 0/1 → 1/1 | note:A3 ]",
@ -6343,6 +6607,69 @@ exports[`runs examples > example "rootNotes" example index 0 1`] = `
]
`;
exports[`runs examples > example "rotationAlpha" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C3 ]",
"[ 1/4 → 1/2 | note:C3 ]",
"[ 1/2 → 3/4 | note:C3 ]",
"[ 3/4 → 1/1 | note:C3 ]",
"[ 1/1 → 5/4 | note:C3 ]",
"[ 5/4 → 3/2 | note:C3 ]",
"[ 3/2 → 7/4 | note:C3 ]",
"[ 7/4 → 2/1 | note:C3 ]",
"[ 2/1 → 9/4 | note:C3 ]",
"[ 9/4 → 5/2 | note:C3 ]",
"[ 5/2 → 11/4 | note:C3 ]",
"[ 11/4 → 3/1 | note:C3 ]",
"[ 3/1 → 13/4 | note:C3 ]",
"[ 13/4 → 7/2 | note:C3 ]",
"[ 7/2 → 15/4 | note:C3 ]",
"[ 15/4 → 4/1 | note:C3 ]",
]
`;
exports[`runs examples > example "rotationBeta" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C3 ]",
"[ 1/4 → 1/2 | note:C3 ]",
"[ 1/2 → 3/4 | note:C3 ]",
"[ 3/4 → 1/1 | note:C3 ]",
"[ 1/1 → 5/4 | note:C3 ]",
"[ 5/4 → 3/2 | note:C3 ]",
"[ 3/2 → 7/4 | note:C3 ]",
"[ 7/4 → 2/1 | note:C3 ]",
"[ 2/1 → 9/4 | note:C3 ]",
"[ 9/4 → 5/2 | note:C3 ]",
"[ 5/2 → 11/4 | note:C3 ]",
"[ 11/4 → 3/1 | note:C3 ]",
"[ 3/1 → 13/4 | note:C3 ]",
"[ 13/4 → 7/2 | note:C3 ]",
"[ 7/2 → 15/4 | note:C3 ]",
"[ 15/4 → 4/1 | note:C3 ]",
]
`;
exports[`runs examples > example "rotationGamma" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C3 ]",
"[ 1/4 → 1/2 | note:C3 ]",
"[ 1/2 → 3/4 | note:C3 ]",
"[ 3/4 → 1/1 | note:C3 ]",
"[ 1/1 → 5/4 | note:C3 ]",
"[ 5/4 → 3/2 | note:C3 ]",
"[ 3/2 → 7/4 | note:C3 ]",
"[ 7/4 → 2/1 | note:C3 ]",
"[ 2/1 → 9/4 | note:C3 ]",
"[ 9/4 → 5/2 | note:C3 ]",
"[ 5/2 → 11/4 | note:C3 ]",
"[ 11/4 → 3/1 | note:C3 ]",
"[ 3/1 → 13/4 | note:C3 ]",
"[ 13/4 → 7/2 | note:C3 ]",
"[ 7/2 → 15/4 | note:C3 ]",
"[ 15/4 → 4/1 | note:C3 ]",
]
`;
exports[`runs examples > example "round" example index 0 1`] = `
[
"[ 0/1 → 1/3 | note:D3 ]",
@ -7537,6 +7864,8 @@ exports[`runs examples > example "speed" example index 0 1`] = `
]
`;
exports[`runs examples > example "speed" example index 0 2`] = `[]`;
exports[`runs examples > example "speed" example index 1 1`] = `
[
"[ 0/1 → 1/3 | speed:1 s:piano clip:1 ]",

View file

@ -21,6 +21,9 @@ import '@strudel/xen/xen.mjs';
// import '@strudel/webaudio/webaudio.mjs';
// import '@strudel/serial/serial.mjs';
import '../website/src/repl/piano';
//import * as motionHelpers from '../packages/motion/index.mjs';
//import * as geolocationHelpers from '../packages/geolocation/index.mjs';
import * as gamepadHelpers from '../packages/gamepad/index.mjs';
class MockedNode {
chain() {
@ -169,6 +172,7 @@ evalScope(
uiHelpersMocked,
webaudio,
tonalHelpers,
gamepadHelpers,
/*
toneHelpers,
voicingHelpers,