-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
129 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { z } from 'zod'; | ||
|
||
const RANGE_0_255 = z.number().int().min(0).max(255); | ||
const BLEND_MODES = z.union([ | ||
z.literal('IGNORE'), | ||
z.literal('REPLACE'), | ||
z.literal('5050'), | ||
z.literal('MAXIMUM'), | ||
z.literal('ADDITIVE'), | ||
z.literal('SUB_1'), // TODO verify | ||
z.literal('SUB_2'), // TODO verify | ||
z.literal('EVERY_OTHER_LINE'), | ||
z.literal('EVERY_OTHER_PIXEL'), | ||
z.literal('XOR'), | ||
z.literal('ADJUSTABLE'), | ||
z.literal('MULTIPLY'), | ||
z.literal('BUFFER'), | ||
z.literal('MINIMUM') | ||
]); | ||
|
||
export const effectList = z.object({ | ||
type: z.literal('EffectList'), | ||
enabled: z.boolean(), | ||
clearFrame: z.boolean(), | ||
input: BLEND_MODES, | ||
output: BLEND_MODES, | ||
inAdjustBlend: RANGE_0_255, | ||
outAdjustBlend: RANGE_0_255, | ||
inBuffer: z.number().int().min(1).max(8), | ||
outBuffer: z.number().int().min(1).max(8), | ||
inBufferInvert: z.boolean(), | ||
outBufferInvert: z.boolean(), | ||
enableOnBeat: z.boolean(), | ||
enableOnBeatFor: z.number().int().min(0).safe(), // TODO validate | ||
code: z.object({ | ||
enabled: z.boolean(), | ||
init: z.string(), | ||
perFrame: z.string() | ||
}), | ||
// TODO components: [] | ||
}).required(); | ||
|
||
export type EffectList = z.infer<typeof effectList>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { z } from 'zod'; | ||
|
||
const MISC = z.literal('Misc'); | ||
const RANGE_0_255 = z.number().int().min(0).max(255); | ||
|
||
export const bufferSave = z.object({ | ||
type: z.literal('BufferSave'), | ||
group: MISC, | ||
action: z.union([ | ||
z.literal('SAVE'), | ||
z.literal('RESTORE'), | ||
z.literal('ALTERNATE_SAVE_RESTORE'), | ||
z.literal('ALTERNATE_RESTORE_SAVE') | ||
]), | ||
bufferId: z.number().int().min(1).max(8), | ||
blendMode: z.union([ | ||
z.literal('IGNORE'), | ||
z.literal('REPLACE'), | ||
z.literal('FIFTY_FIFTY'), | ||
z.literal('MAXIMUM'), | ||
z.literal('ADDITIVE'), | ||
z.literal('SUB_DEST_SRC'), | ||
z.literal('SUB_SRC_DEST'), | ||
z.literal('EVERY_OTHER_LINE'), | ||
z.literal('EVERY_OTHER_PIXEL'), | ||
z.literal('XOR'), | ||
z.literal('ADJUSTABLE'), | ||
z.literal('MULTIPLY'), | ||
z.literal('BUFFER') | ||
]), | ||
adjustBlend: RANGE_0_255 | ||
}).required(); | ||
|
||
export const comment = z.object({ | ||
type: z.literal('Comment'), | ||
group: MISC, | ||
text: z.string() | ||
}).required(); | ||
|
||
export const customBpm = z.object({ | ||
type: z.literal('CustomBPM'), | ||
group: MISC, | ||
enabled: z.boolean(), | ||
mode: z.union([ | ||
z.literal('ARBITRARY'), | ||
z.literal('SKIP'), | ||
z.literal('REVERSE') | ||
]), | ||
arbitraryValue: RANGE_0_255, | ||
skipValue: RANGE_0_255, | ||
skipFirstBeats: RANGE_0_255 | ||
}).required(); | ||
|
||
export const setRenderMode = z.object({ | ||
type: z.literal('SetRenderMode'), | ||
group: MISC, | ||
blend: z.union([ | ||
z.literal('BLEND_REPLACE'), | ||
z.literal('BLEND_ADDITIVE'), | ||
z.literal('BLEND_MAXIMUM'), | ||
z.literal('BLEND_5050'), | ||
z.literal('BLEND_SUB1'), | ||
z.literal('BLEND_SUB2'), | ||
z.literal('BLEND_MULTIPLY'), | ||
z.literal('BLEND_ADJUSTABLE'), | ||
z.literal('BLEND_XOR'), | ||
z.literal('BLEND_MINIMUM'), | ||
]), | ||
adjustBlend: RANGE_0_255, | ||
lineSize: RANGE_0_255, | ||
enabled: z.boolean() | ||
}).required(); | ||
|
||
export type BufferSave = z.infer<typeof bufferSave>; | ||
export type Comment = z.infer<typeof comment>; | ||
export type CustomBpm = z.infer<typeof customBpm>; | ||
export type SetRenderMode = z.infer<typeof setRenderMode>; |