UNPKG

@bscotch/yy

Version:

Stringify, parse, read, and write GameMaker yy and yyp files.

62 lines 2.39 kB
// Generated by ts-to-zod import { z } from 'zod'; import { yyBaseSchema } from './YyBase.js'; import { fixedNumber } from './utility.js'; export var SoundBitDepth; (function (SoundBitDepth) { SoundBitDepth[SoundBitDepth["Bit8"] = 0] = "Bit8"; SoundBitDepth[SoundBitDepth["Bit16"] = 1] = "Bit16"; })(SoundBitDepth || (SoundBitDepth = {})); export var SoundChannel; (function (SoundChannel) { SoundChannel[SoundChannel["Mono"] = 0] = "Mono"; SoundChannel[SoundChannel["Stereo"] = 1] = "Stereo"; SoundChannel[SoundChannel["ThreeD"] = 2] = "ThreeD"; })(SoundChannel || (SoundChannel = {})); export var SoundCompression; (function (SoundCompression) { SoundCompression[SoundCompression["Uncompressed"] = 0] = "Uncompressed"; SoundCompression[SoundCompression["Compressed"] = 1] = "Compressed"; SoundCompression[SoundCompression["UncompressedOnLoad"] = 2] = "UncompressedOnLoad"; SoundCompression[SoundCompression["CompressedStreamed"] = 3] = "CompressedStreamed"; })(SoundCompression || (SoundCompression = {})); const soundChannelSchema = z.nativeEnum(SoundChannel); const soundCompressionSchema = z.nativeEnum(SoundCompression); const soundBitDepthSchema = z.nativeEnum(SoundBitDepth); const soundSampleRateSchema = z.union([ z.literal(5512), z.literal(11025), z.literal(22050), z.literal(32000), z.literal(44100), z.literal(48000), ]); export const yySoundSchema = yyBaseSchema.extend({ compression: soundCompressionSchema.default(0), conversionMode: z.number().optional().default(0), volume: fixedNumber(z.number().min(0).max(1)).default(1), preload: z.boolean().default(false), bitRate: z.number().default(128), sampleRate: soundSampleRateSchema.default(44100), type: soundChannelSchema.default(1), bitDepth: soundBitDepthSchema.default(1), audioGroupId: z .object({ name: z.string(), path: z.string(), }) .default({ name: 'audiogroup_default', path: 'audiogroups/audiogroup_default', }), /** `${name}.${ext} (e.g. mySound) */ soundFile: z.string(), /** * Duration of the sound. Automatically * computed by GameMaker, so Stitch can generally * ignore it. */ duration: fixedNumber(z.number(), 2).optional(), resourceType: z.literal('GMSound').default('GMSound'), }); //# sourceMappingURL=YySound.js.map