From c3477f0c1722d5b91f6928b83fa6e79303cab4e1 Mon Sep 17 00:00:00 2001 From: Marek Malek Date: Thu, 2 Jul 2026 10:54:26 +0200 Subject: [PATCH 1/2] fix: eslint errors --- packages/audiodocs/.eslintrc | 3 +- packages/audiodocs/docusaurus.config.js | 2 +- packages/audiodocs/sidebars.js | 4 +-- .../AudioBufferSourceExample.tsx | 2 +- .../audiodocs/static/signalsmithStretch.mjs | 28 ++++++++++++++----- packages/audiodocs/types.d.ts | 2 ++ 6 files changed, 29 insertions(+), 12 deletions(-) diff --git a/packages/audiodocs/.eslintrc b/packages/audiodocs/.eslintrc index 831f35695..90195859c 100644 --- a/packages/audiodocs/.eslintrc +++ b/packages/audiodocs/.eslintrc @@ -5,5 +5,6 @@ "presets": ["@babel/preset-react"], "plugins": ["react-native-worklets/plugin"] } - } + }, + "ignorePatterns": ["static"] } diff --git a/packages/audiodocs/docusaurus.config.js b/packages/audiodocs/docusaurus.config.js index 30bacd7e6..810941ebe 100644 --- a/packages/audiodocs/docusaurus.config.js +++ b/packages/audiodocs/docusaurus.config.js @@ -4,7 +4,7 @@ const lightCodeTheme = require('./src/theme/CodeBlock/highlighting-light.js'); const darkCodeTheme = require('./src/theme/CodeBlock/highlighting-dark.js'); -import { topbarBannerReservationScript } from '@swmansion/t-rex-ui/topbar-banner'; // eslint-disable-line import/first +import { topbarBannerReservationScript } from '@swmansion/t-rex-ui/topbar-banner'; // eslint-disable-line import/first, import/no-unresolved // @ts-expect-error -- .ts extension is intentional; not type-checked by tsc here. import { TOP_BAR_BANNER } from './src/components/topbarBanner.config.ts'; // eslint-disable-line import/first diff --git a/packages/audiodocs/sidebars.js b/packages/audiodocs/sidebars.js index d5620d807..2893c40b7 100644 --- a/packages/audiodocs/sidebars.js +++ b/packages/audiodocs/sidebars.js @@ -5,9 +5,9 @@ - create an ordered group of docs - render a sidebar for each doc of that group - provide next/previous navigation - + The sidebars can be generated from the filesystem, or explicitly defined here. - + Create as many sidebars as you want. */ const sidebars = { diff --git a/packages/audiodocs/src/components/InteractivePlayground/AudioBufferSourceExample/AudioBufferSourceExample.tsx b/packages/audiodocs/src/components/InteractivePlayground/AudioBufferSourceExample/AudioBufferSourceExample.tsx index a6b3bd8a6..a000e0238 100644 --- a/packages/audiodocs/src/components/InteractivePlayground/AudioBufferSourceExample/AudioBufferSourceExample.tsx +++ b/packages/audiodocs/src/components/InteractivePlayground/AudioBufferSourceExample/AudioBufferSourceExample.tsx @@ -83,7 +83,7 @@ const AudioBufferSourceExample: FC = (props) => { setIsPlaying(false); } }; - }, [stopSound, playbackRate,detune,loop,loopStart,loopEnd, pitchCorrection]); + }, [stopSound, playbackRate, detune, loop, loopStart, loopEnd, pitchCorrection]); const handlePlayButtonClick = () => { if (isPlaying) { diff --git a/packages/audiodocs/static/signalsmithStretch.mjs b/packages/audiodocs/static/signalsmithStretch.mjs index 342dad090..20f0fe7eb 100644 --- a/packages/audiodocs/static/signalsmithStretch.mjs +++ b/packages/audiodocs/static/signalsmithStretch.mjs @@ -470,10 +470,19 @@ function registerWorkletProcessor(Module, audioNodeKey) { return result; }, schedule: (objIn, adjustPrevious) => { - let outputTime = 'output' in objIn ? objIn.output : currentTime; - let latestSegment = this.timeMap[this.timeMap.length - 1]; - while (this.timeMap.length && this.timeMap[this.timeMap.length - 1].output >= outputTime) { - latestSegment = this.timeMap.pop(); + let outputTime = 'output' in objIn && objIn.output !== undefined ? objIn.output : currentTime; + let latestSegment = this.timeMap[0]; + for (let i = 0; i < this.timeMap.length; i++) { + if (this.timeMap[i].output <= outputTime) { + latestSegment = this.timeMap[i]; + } else { + break; + } + } + const existingIndex = this.timeMap.findIndex(segment => segment.output === outputTime); + if (existingIndex >= 0) { + latestSegment = this.timeMap[existingIndex]; + this.timeMap.splice(existingIndex, 1); } let obj = { active: latestSegment.active, @@ -489,7 +498,12 @@ function registerWorkletProcessor(Module, audioNodeKey) { let rate = latestSegment.active ? latestSegment.rate : 0; obj.input = latestSegment.input + (obj.output - latestSegment.output) * rate; } - this.timeMap.push(obj); + const insertAt = existingIndex >= 0 ? existingIndex : this.timeMap.findIndex(segment => segment.output > outputTime); + if (insertAt === -1) { + this.timeMap.push(obj); + } else { + this.timeMap.splice(insertAt, 0, obj); + } if (adjustPrevious && this.timeMap.length > 1) { let previous = this.timeMap[this.timeMap.length - 2]; if (previous.output < currentTime) { @@ -500,12 +514,12 @@ function registerWorkletProcessor(Module, audioNodeKey) { previous.rate = (obj.input - previous.input) / (obj.output - previous.output); } let currentMapSegment = this.timeMap[0]; - while (this.timeMap.length > 1 && this.timeMap[1].output <= outputTime) { + while (this.timeMap.length > 1 && this.timeMap[1].output <= currentTime) { this.timeMap.shift(); currentMapSegment = this.timeMap[0]; } let rate = currentMapSegment.active ? currentMapSegment.rate : 0; - let inputTime = currentMapSegment.input + (outputTime - currentMapSegment.output) * rate; + let inputTime = currentMapSegment.input + (currentTime - currentMapSegment.output) * rate; this.timeIntervalCounter = this.timeIntervalSamples; this.port.postMessage(['time', inputTime]); return obj; diff --git a/packages/audiodocs/types.d.ts b/packages/audiodocs/types.d.ts index c612f1de4..913a57389 100644 --- a/packages/audiodocs/types.d.ts +++ b/packages/audiodocs/types.d.ts @@ -10,3 +10,5 @@ module "*.svg" { const ReactComponent: React.FC>; export default ReactComponent; } + +declare module '@swmansion/t-rex-ui/topbar-banner'; \ No newline at end of file From 2fba3d97e52ef22c14173a965bcb80a6f7bd14d5 Mon Sep 17 00:00:00 2001 From: Marek Malek Date: Thu, 2 Jul 2026 11:15:23 +0200 Subject: [PATCH 2/2] chore: bump lib ver --- packages/audiodocs/package.json | 2 +- packages/audiodocs/yarn.lock | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/audiodocs/package.json b/packages/audiodocs/package.json index a0172e28b..e422a091f 100644 --- a/packages/audiodocs/package.json +++ b/packages/audiodocs/package.json @@ -49,7 +49,7 @@ "react-dom": "^19.1.1", "react-draggable": "^4.4.5", "react-native": "^0.71.4", - "react-native-audio-api": "*", + "react-native-audio-api": "latest", "react-native-canvas": "^0.1.40", "react-native-gesture-handler": "^2.16.0", "react-native-reanimated": "^4.0.3", diff --git a/packages/audiodocs/yarn.lock b/packages/audiodocs/yarn.lock index 2c9092ebc..fa18698e7 100644 --- a/packages/audiodocs/yarn.lock +++ b/packages/audiodocs/yarn.lock @@ -12051,10 +12051,12 @@ react-loadable-ssr-addon-v5-slorber@^1.0.1: dependencies: "@types/react" "*" -react-native-audio-api@*: - version "0.8.2" - resolved "https://registry.yarnpkg.com/react-native-audio-api/-/react-native-audio-api-0.8.2.tgz#5deb4ffe07538b8d1c747af3903025632a23f6a2" - integrity sha512-p+a7gL1wy09yXoqUTYdO+tAQe/G7DpWFrFUDULu4dFUsyPaVd0T10Y7Nf5P391Ldg5A6F/aIfoUtKf150RyKmw== +react-native-audio-api@latest: + version "0.13.1" + resolved "https://registry.yarnpkg.com/react-native-audio-api/-/react-native-audio-api-0.13.1.tgz#e998747f490ae0b638106a2e719d4f9e5483b924" + integrity sha512-FuUcj/flfWImRFQkxpJVJe0HueQxwliCjeI+kVcWQPOj46mkpsbEhvNF0IPRNwWiDl1GaiYka8oLShZ+Y7Y9OA== + dependencies: + semver "^7.7.3" react-native-canvas@^0.1.40: version "0.1.40" @@ -12914,6 +12916,11 @@ semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== +semver@^7.7.3: + version "7.8.5" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.8.5.tgz#39b646037dd50c14fb451e7e4cac58ed8b863f69" + integrity sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA== + send@0.19.0: version "0.19.0" resolved "https://registry.yarnpkg.com/send/-/send-0.19.0.tgz#bbc5a388c8ea6c048967049dbeac0e4a3f09d7f8"