diff --git a/.github/workflows/on-push-main.yml b/.github/workflows/on-push-main.yml index 52493fcb..91659518 100644 --- a/.github/workflows/on-push-main.yml +++ b/.github/workflows/on-push-main.yml @@ -30,6 +30,6 @@ jobs: env: REPO: self BRANCH: public # The branch name where you want to push the assets - FOLDER: ./zss/terminal/dist # The directory where your assets are generated + FOLDER: ./cafe/dist # The directory where your assets are generated MESSAGE: 'Build: ({sha}) {msg}' # The commit message GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token diff --git a/zss/terminal/.env b/cafe/.env similarity index 100% rename from zss/terminal/.env rename to cafe/.env diff --git a/404.html b/cafe/404.html similarity index 100% rename from 404.html rename to cafe/404.html diff --git a/zss/terminal/app.tsx b/cafe/app.tsx similarity index 97% rename from zss/terminal/app.tsx rename to cafe/app.tsx index b2217754..eab92506 100644 --- a/zss/terminal/app.tsx +++ b/cafe/app.tsx @@ -12,9 +12,7 @@ import { vm_loadfile } from 'zss/device/api' import { enableaudio } from 'zss/device/synth' import { getgadgetclientplayer } from 'zss/gadget/data/state' import { ispresent } from 'zss/mapping/types' - -import { Terminal } from './terminal' - +import { Terminal } from 'zss/terminal/terminal' import 'zss/platform' extend({ diff --git a/zss/terminal/favicon.ico b/cafe/favicon.ico similarity index 100% rename from zss/terminal/favicon.ico rename to cafe/favicon.ico diff --git a/zss/terminal/index.css b/cafe/index.css similarity index 100% rename from zss/terminal/index.css rename to cafe/index.css diff --git a/zss/terminal/index.html b/cafe/index.html similarity index 100% rename from zss/terminal/index.html rename to cafe/index.html diff --git a/zss/terminal/index.tsx b/cafe/index.tsx similarity index 100% rename from zss/terminal/index.tsx rename to cafe/index.tsx diff --git a/zss/terminal/manifest.webmanifest b/cafe/manifest.webmanifest similarity index 100% rename from zss/terminal/manifest.webmanifest rename to cafe/manifest.webmanifest diff --git a/zss/terminal/public/benchmarks-min/d-adreno.json b/cafe/public/benchmarks-min/d-adreno.json similarity index 100% rename from zss/terminal/public/benchmarks-min/d-adreno.json rename to cafe/public/benchmarks-min/d-adreno.json diff --git a/zss/terminal/public/benchmarks-min/d-amd.json b/cafe/public/benchmarks-min/d-amd.json similarity index 100% rename from zss/terminal/public/benchmarks-min/d-amd.json rename to cafe/public/benchmarks-min/d-amd.json diff --git a/zss/terminal/public/benchmarks-min/d-apple.json b/cafe/public/benchmarks-min/d-apple.json similarity index 100% rename from zss/terminal/public/benchmarks-min/d-apple.json rename to cafe/public/benchmarks-min/d-apple.json diff --git a/zss/terminal/public/benchmarks-min/d-geforce.json b/cafe/public/benchmarks-min/d-geforce.json similarity index 100% rename from zss/terminal/public/benchmarks-min/d-geforce.json rename to cafe/public/benchmarks-min/d-geforce.json diff --git a/zss/terminal/public/benchmarks-min/d-intel.json b/cafe/public/benchmarks-min/d-intel.json similarity index 100% rename from zss/terminal/public/benchmarks-min/d-intel.json rename to cafe/public/benchmarks-min/d-intel.json diff --git a/zss/terminal/public/benchmarks-min/d-nvidia.json b/cafe/public/benchmarks-min/d-nvidia.json similarity index 100% rename from zss/terminal/public/benchmarks-min/d-nvidia.json rename to cafe/public/benchmarks-min/d-nvidia.json diff --git a/zss/terminal/public/benchmarks-min/d-radeon.json b/cafe/public/benchmarks-min/d-radeon.json similarity index 100% rename from zss/terminal/public/benchmarks-min/d-radeon.json rename to cafe/public/benchmarks-min/d-radeon.json diff --git a/zss/terminal/public/benchmarks-min/m-adreno.json b/cafe/public/benchmarks-min/m-adreno.json similarity index 100% rename from zss/terminal/public/benchmarks-min/m-adreno.json rename to cafe/public/benchmarks-min/m-adreno.json diff --git a/zss/terminal/public/benchmarks-min/m-apple-ipad.json b/cafe/public/benchmarks-min/m-apple-ipad.json similarity index 100% rename from zss/terminal/public/benchmarks-min/m-apple-ipad.json rename to cafe/public/benchmarks-min/m-apple-ipad.json diff --git a/zss/terminal/public/benchmarks-min/m-apple.json b/cafe/public/benchmarks-min/m-apple.json similarity index 100% rename from zss/terminal/public/benchmarks-min/m-apple.json rename to cafe/public/benchmarks-min/m-apple.json diff --git a/zss/terminal/public/benchmarks-min/m-intel.json b/cafe/public/benchmarks-min/m-intel.json similarity index 100% rename from zss/terminal/public/benchmarks-min/m-intel.json rename to cafe/public/benchmarks-min/m-intel.json diff --git a/zss/terminal/public/benchmarks-min/m-mali-t.json b/cafe/public/benchmarks-min/m-mali-t.json similarity index 100% rename from zss/terminal/public/benchmarks-min/m-mali-t.json rename to cafe/public/benchmarks-min/m-mali-t.json diff --git a/zss/terminal/public/benchmarks-min/m-mali.json b/cafe/public/benchmarks-min/m-mali.json similarity index 100% rename from zss/terminal/public/benchmarks-min/m-mali.json rename to cafe/public/benchmarks-min/m-mali.json diff --git a/zss/terminal/public/benchmarks-min/m-nvidia.json b/cafe/public/benchmarks-min/m-nvidia.json similarity index 100% rename from zss/terminal/public/benchmarks-min/m-nvidia.json rename to cafe/public/benchmarks-min/m-nvidia.json diff --git a/zss/terminal/public/benchmarks-min/m-powervr.json b/cafe/public/benchmarks-min/m-powervr.json similarity index 100% rename from zss/terminal/public/benchmarks-min/m-powervr.json rename to cafe/public/benchmarks-min/m-powervr.json diff --git a/zss/terminal/public/benchmarks-min/m-samsung.json b/cafe/public/benchmarks-min/m-samsung.json similarity index 100% rename from zss/terminal/public/benchmarks-min/m-samsung.json rename to cafe/public/benchmarks-min/m-samsung.json diff --git a/zss/terminal/vite-env.d.ts b/cafe/vite-env.d.ts similarity index 100% rename from zss/terminal/vite-env.d.ts rename to cafe/vite-env.d.ts diff --git a/package.json b/package.json index d114b930..beeacf33 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "preview": "yarn && yarn clear && vite preview", "build": "yarn && yarn clear && vite build", "build:strict": "tsc && vite build", - "build:copy-404": "cp ./404.html ./zss/terminal/dist", - "build:copy-cname": "cp .github/CNAME ./zss/terminal/dist" + "build:copy-404": "cp ./404.html ./cafe/dist", + "build:copy-cname": "cp .github/CNAME ./cafe/dist" }, "dependencies": {}, "devDependencies": { @@ -89,4 +89,4 @@ "yjs": "^13.6.15", "zustand": "^5.0.1" } -} +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 21639d39..9181d466 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,10 +3,22 @@ "target": "ES2020", "useDefineForClassFields": true, "paths": { - "zss/*": ["./zss/*"] + "zss/*": [ + "./zss/*" + ], + "cafe/*": [ + "./cafe/*" + ], }, - "lib": ["ES2021", "DOM", "DOM.Iterable", "WEBWORKER"], - "types": ["vite-plugin-arraybuffer/types"], + "lib": [ + "ES2021", + "DOM", + "DOM.Iterable", + "WEBWORKER" + ], + "types": [ + "vite-plugin-arraybuffer/types" + ], "module": "ESNext", "skipLibCheck": true, /* Bundler mode */ @@ -22,10 +34,13 @@ "noUnusedParameters": true, "noFallthroughCasesInSwitch": true }, - "include": ["zss"], + "include": [ + "zss", + "cafe", + ], "references": [ { "path": "./tsconfig.node.json" } ] -} +} \ No newline at end of file diff --git a/tsconfig.lint.json b/tsconfig.lint.json index e4343b63..f8f8e7a4 100644 --- a/tsconfig.lint.json +++ b/tsconfig.lint.json @@ -1,4 +1,8 @@ { "extends": "./tsconfig.json", - "include": ["zss", "vite.config.ts"] -} + "include": [ + "zss", + "cafe", + "vite.config.ts" + ] +} \ No newline at end of file diff --git a/tsconfig.node.json b/tsconfig.node.json index 97ede7ee..d5ed4eaa 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -7,5 +7,7 @@ "allowSyntheticDefaultImports": true, "strict": true }, - "include": ["vite.config.ts"] -} + "include": [ + "vite.config.ts" + ] +} \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 697675f3..6daf400f 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -13,7 +13,7 @@ import pkg from './package.json' // https://vitejs.dev/config/ export default defineConfig(({ mode }) => { const envprefix = 'ZSS_' - const root = path.join('zss', 'terminal') + const root = path.join('cafe') const apppath = path.join(process.cwd(), root) // Load app-level env vars to node-level env vars. diff --git a/zss/device/synth.ts b/zss/device/synth.ts index 38f8200b..1c957b2e 100644 --- a/zss/device/synth.ts +++ b/zss/device/synth.ts @@ -57,7 +57,8 @@ export function enableaudio() { function createsynth() { const destination = getDestination() - const mainvolume = new Volume(6) + const mainvolume = new Volume() + mainvolume.volume.value = 8 mainvolume.connect(destination) const maincompressor = new Compressor({ @@ -69,10 +70,10 @@ function createsynth() { }) maincompressor.connect(mainvolume) - const maingain = new Gain(0.888) + const maingain = new Gain() maingain.connect(maincompressor) - const drumgain = new Gain(0.777) + const drumgain = new Gain() drumgain.connect(maincompressor) const SOURCE = [ @@ -582,7 +583,14 @@ function createsynth() { // start it pacer.start(0) - return { addplay, SOURCE } + // stop playback + function stopplay() { + pacer.clear() + pacertime = -1 + pacercount = 0 + } + + return { addplay, stopplay, SOURCE } } function validatesynthtype( @@ -661,7 +669,13 @@ const synthdevice = createdevice('synth', [], (message) => { // -negative priority means music synth 1-9 // positive priority means sfx synth 0 // only a single set of drums between music & sfx - synth.addplay(priority, buffer) + if (buffer === '') { + // stop playback + synth.stopplay() + } else { + // add to playback + synth.addplay(priority, buffer) + } } break case 'voice': @@ -951,7 +965,7 @@ const synthdevice = createdevice('synth', [], (message) => { switch (config) { case 'on': // default on value - fx.wet.value = 0.333 + fx.wet.value = 0.2 break case 'off': fx.wet.value = 0.0 diff --git a/zss/device/tape.ts b/zss/device/tape.ts index 0927e808..ab1da079 100644 --- a/zss/device/tape.ts +++ b/zss/device/tape.ts @@ -41,11 +41,9 @@ createdevice('tape', [], (message) => { if (!editor.open) { switch (nextlayout as TAPE_DISPLAY) { case TAPE_DISPLAY.SPLIT_X: - case TAPE_DISPLAY.SPLIT_Y: case TAPE_DISPLAY.SPLIT_X_ALT: - case TAPE_DISPLAY.SPLIT_Y_ALT: // skip over these to right - nextlayout = TAPE_DISPLAY.RIGHT + nextlayout = TAPE_DISPLAY.TOP break } } diff --git a/zss/gadget/components/tape/layout.tsx b/zss/gadget/components/tape/layout.tsx index 560908b3..fdd11a30 100644 --- a/zss/gadget/components/tape/layout.tsx +++ b/zss/gadget/components/tape/layout.tsx @@ -50,7 +50,6 @@ export function TapeLayout({ context }: TapeLayoutProps) { const bottom = context.height - 1 const edge = textformatreadedges(context) const xstep = Math.floor(edge.width * 0.5) - const ystep = Math.floor(edge.height * 0.5) const xleft = useMemo( () => forkonedge(0, 0, xstep - 1, bottom, context), @@ -60,14 +59,6 @@ export function TapeLayout({ context }: TapeLayoutProps) { () => forkonedge(xstep, 0, right, bottom, context), [xstep, right, bottom, context], ) - const ytop = useMemo( - () => forkonedge(0, 0, right, ystep - 1, context), - [ystep, right, context], - ) - const ybottom = useMemo( - () => forkonedge(0, ystep, right, bottom, context), - [ystep, right, bottom, context], - ) if (editoropen) { let first: MAYBE @@ -78,17 +69,11 @@ export function TapeLayout({ context }: TapeLayoutProps) { first = xleft second = xright break - case TAPE_DISPLAY.SPLIT_Y: - case TAPE_DISPLAY.SPLIT_Y_ALT: - first = ytop - second = ybottom - break } if (ispresent(first) && ispresent(second)) { switch (layout) { case TAPE_DISPLAY.SPLIT_X: - case TAPE_DISPLAY.SPLIT_Y: return ( <> @@ -100,7 +85,6 @@ export function TapeLayout({ context }: TapeLayoutProps) { ) case TAPE_DISPLAY.SPLIT_X_ALT: - case TAPE_DISPLAY.SPLIT_Y_ALT: return ( <> diff --git a/zss/gadget/data/state.ts b/zss/gadget/data/state.ts index 50119803..4becf4cc 100644 --- a/zss/gadget/data/state.ts +++ b/zss/gadget/data/state.ts @@ -56,10 +56,6 @@ export enum TAPE_DISPLAY { FULL, SPLIT_X, SPLIT_X_ALT, - SPLIT_Y, - SPLIT_Y_ALT, - RIGHT, - LEFT, MAX, }