Skip to content

Commit

Permalink
shuffle
Browse files Browse the repository at this point in the history
  • Loading branch information
goldbuick committed Dec 24, 2024
1 parent fbbd588 commit 4cdc77a
Show file tree
Hide file tree
Showing 35 changed files with 57 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/on-push-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
File renamed without changes.
File renamed without changes.
4 changes: 1 addition & 3 deletions zss/terminal/app.tsx → cafe/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -89,4 +89,4 @@
"yjs": "^13.6.15",
"zustand": "^5.0.1"
}
}
}
25 changes: 20 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -22,10 +34,13 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["zss"],
"include": [
"zss",
"cafe",
],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}
}
8 changes: 6 additions & 2 deletions tsconfig.lint.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"extends": "./tsconfig.json",
"include": ["zss", "vite.config.ts"]
}
"include": [
"zss",
"cafe",
"vite.config.ts"
]
}
6 changes: 4 additions & 2 deletions tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
"allowSyntheticDefaultImports": true,
"strict": true
},
"include": ["vite.config.ts"]
}
"include": [
"vite.config.ts"
]
}
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
26 changes: 20 additions & 6 deletions zss/device/synth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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 = [
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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':
Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions zss/device/tape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
16 changes: 0 additions & 16 deletions zss/gadget/components/tape/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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<WRITE_TEXT_CONTEXT>
Expand All @@ -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 (
<>
<WriteTextContext.Provider value={first}>
Expand All @@ -100,7 +85,6 @@ export function TapeLayout({ context }: TapeLayoutProps) {
</>
)
case TAPE_DISPLAY.SPLIT_X_ALT:
case TAPE_DISPLAY.SPLIT_Y_ALT:
return (
<>
<WriteTextContext.Provider value={first}>
Expand Down
4 changes: 0 additions & 4 deletions zss/gadget/data/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ export enum TAPE_DISPLAY {
FULL,
SPLIT_X,
SPLIT_X_ALT,
SPLIT_Y,
SPLIT_Y_ALT,
RIGHT,
LEFT,
MAX,
}

Expand Down

0 comments on commit 4cdc77a

Please sign in to comment.