Changelog
3.0.1
- The schema is published in a
SchemaStringValue underSoundService.VluxySF_Schemainstead of a string attribute. Studio and Server Authority now limit string attributes to 50 characters, andSetAttributethrows past it in Studio, which stoppedInitServer("the library could not start"). A client still reads the old attribute from an older server, and a schema longer than one StringValue holds (199,999 characters; 10,000 sounds are about 470,000) is split overSchema,Schema#2, ... with the count in theSchemaPiecesattribute, so it still replicates with the place instead of every client askingRequest.
3.0.0
3.0 renames several functions, makes the schema about a third of its old size, and changes how the library behaves when something goes wrong: nothing it does at runtime throws into your game code anymore. Code written for 2.x needs the renames below.
Renamed
| 2.x | 3.0 |
|---|---|
VluxySF.FetchStrict(name, parent, preset) | VluxySF.TryFetch(name, parent, preset) |
VluxySF.FetchPlayOnce(name, parent, preset, waitOnLoad) | VluxySF.OneShot(name, parent, preset) |
Startup.IsInitialized() | Startup.IsReady() |
Startup.WaitForSchema() | Startup.WaitUntilReady(timeout?) |
Startup.ConnectForSchema(callback) | Startup.OnReady(callback) |
Startup.WaitForPreload() | Startup.WaitUntilPreloaded(timeout?) |
Preload.Selected(...) | Preload.AddAsync(...) |
Preload.Get() | Preload.GetNames(), Preload.Has(name) |
Cache.Get() | Cache.GetNames() |
Groups.GetByName(name) | Groups.Get(name) |
Groups.Get() | Groups.GetAll() |
Groups.SetVolumes(main, volumes) | Groups.SetMainVolume(main) and Groups.SetVolumes(volumes) |
Jitter.Default(center, spread) | Jitter.Uniform(center, spread) |
Jitter.UnitLog(center, spread) | Jitter.Natural(center, spread) |
Jitter.Scale(spread) | Jitter.Uniform(1, spread) |
Groups.Get changed meaning: it used to return every group and now returns one by name, so check each call rather than replacing it blindly. The SoundGroups and SoundPresets API pages are now Groups and Presets.
Added
VluxySF.WithWrapper(wrap)returns a copy of the library whoseFetchandTryFetchreturn your own class instead of aSound. It is fully typed, andVluxySFitself is unchanged.Schema.Has(name)checks whether a sound exists without a warning.Groups.SetVolume(name, volume),Groups.GetMain(),Groups.GetVolumes()andGroups.GetMainVolume().Startup.WaitUntilReadyandStartup.WaitUntilPreloadedtake an optional timeout and returnfalseif it passed first.
Changed
- Nothing the library does at runtime throws anymore:
- Called before the library has started, every function warns once and returns a blank sound,
nilor an empty result. PreloadandCachewarn once and do nothing on the server.InitServerandInitClientwarn when called twice, on the wrong side or with a bad argument, and a failure while starting turns sounds off with a warning instead of breaking the calling script. AnInitcall after a failed one says so instead of claiming the first call is still running.InitClientwaits at most 30 seconds for the schema and the server's instances. If the server could not start, it warns and returns with sounds off for that player instead of yielding forever.- A child of
SOUNDSthat is not a Configuration, or a second group with a name already used, is skipped with a warning. - A volume that is not a number from 0 to 10 prints a warning and is ignored.
Fetch,TryFetchandOneShotwarn and ignore a parent that is not an Instance or a preset that is not a function. A parent that refuses the sound (locked or destroyed) warns and sends it toUnattachedSounds. A preset that throws destroys the sound first, so nothing is left behind.Conversions.ToDefinitionandFromDefinitionwarn and return a blank definition or a blankSoundon bad input, and an effect entry that is not a table is skipped with a warning.Presetsbuilders given a bad argument (Volume("loud"),Parent(nil)) warn where they are called and return a preset that does nothing;Combineleaves out arguments that are not functions.Presets.Parentwarns instead of throwing when the parent refuses the sound.Jitterbuilders given something that is not a finite number warn and fall back to a value with no variation.Jitter.Rangewithminabovemaxswaps them.- Before the library has started,
Fetchparents the blank sound to the parent you gave; the preset is not applied to it.
- Called before the library has started, every function warns once and returns a blank sound,
OneShothas nowaitOnLoadargument. Roblox already holds a played sound until its audio loads and plays it from the beginning.Schema.Getreturnsnilbefore the library has started, andSchema.GetDefinitionno longer warns for an unknown name.Fetchbuilds preloaded sounds instead of cloning their kept copies, which measured faster. It still clones warmed sounds.Groups.GetNameslists groups in the order they appear underSOUNDS.- Jitter values are kept at 0 or more instead of being clamped from 0 to 10.
- The schema is about a third of its old size. Counts and lengths are variable-length integers,
rbxassetid://ids are stored as numbers, numbers that fit 32-bit floats take 4 bytes, and the whole schema is compressed with a fast LZ4-style compressor. A real 180-sound game went from 15,765 bytes to 5,459; decompressing it takes 0.05 ms. - The schema replicates as one string attribute named
Schemaon aVluxySF_SchemaConfiguration inSoundService, visible in the Explorer. It used to be split across StringValues under the library module. The attribute is left in place on the client, so other code can still read it. - A
RemoteFunctionnamedRequestunderVluxySF_Schemais the fallback transport. A client whose attribute is missing, cut short or damaged (NextGenerationReplicationlimits script-set string attributes) asks the server for the compressed schema as a buffer instead, a few times per player at most. The server warns and relies on the fallback when Roblox refuses to store the attribute. - Every instance the library creates in
SoundService(VluxySF_Schema,Request,SOUNDS, each group,PreloadedSounds,WarmedSounds,UnattachedSounds) carries aVluxySFattribute. The client finds them by name, class and that mark, so aSOUNDSSoundGroup orUnattachedSoundsof your own inSoundServiceis never mistaken for the library's. PlayingandTimePositionare never stored. They are playback state, not setup: aSoundinSOUNDSis never playing, and a fetched sound is always stopped at the start.Playing/TimePositionare gone from theSoundSerializedtype.- The kept copies in
PreloadedSoundsandWarmedSoundsare silent:PlayingandPlayOnRemoveare off on them.Fetchrestores the authoredPlayOnRemoveon the clones it hands out. - Names and other strings in the schema have no length limit, and there is no limit on the number of unique names.
Fixed
OneShotdestroys a sound whose audio has not loaded within 10 seconds, with a warning. Deleted, moderated or private audio never firesEnded, so these sounds used to stay inUnattachedSoundsforever.OneShotno longer reports "did not load" for a sound that your code destroyed, or that went with its destroyed parent, before it ended. The watchdog is cancelled as soon as the sound is finished by any route.- A preloaded or warmed sound authored with
Playingon no longer plays audibly fromSoundServiceon every client, and chilling a sound withPlayOnRemoveno longer makes a sound. Startup.WaitUntilPreloadedreturns right away on the server.WaitForPreloadused to wait there forever.Startup.WaitUntilReadyandWaitUntilPreloadedno longer print an error when the waiting thread was cancelled or closed with its script before the library was ready.- A failed audio preload only warns. It used to be able to throw from
Preloadand leave preload waits hanging. - Enums read from one schema can no longer be mixed up with another schema's, and the enum cache key can no longer collide once a schema holds more than 65,536 unique strings.
- Base64 decoding returns
nilfor text with a zero byte in it instead of throwing. - The
Conversions.FromDefinitiondoc sample type-checks under--!strict: each effect carries its class name asName.
Removed
- The
GeneratedSoundNamestype, kept in 2.0 only for code that annotated sound names with it. Usestring. - The magic byte and format version at the start of the schema. Server and client always run the same copy of the library, so the check could never fail.
2.0.0
The core was rewritten for speed and scale. The public API is the same shape as 1.x, with the changes below.
Changed
- The schema is compiled on the server into one compact buffer and replicates to clients with the place. Clients no longer request it, and the server does no work per player.
- Definitions are decoded when they are first asked for.
Schema.Get()andSchema.GetDefinitions()decode every definition and freeze the table.Schema.GetDefinition(name)decodes one. Startup.InitClient(0)starts the preloads in the background without waiting and prints no timeout warning.- On the client, the schema is marked ready as soon as it is received.
WaitForSchemaandConnectForSchemaresume before the preloads finish;InitClientitself still waits for them. Startup.InitServerdetaches theSOUNDSConfiguration right away and destroys it shortly after instead of synchronously.Startup.InitServerandStartup.InitClienterror when called a second time.- Two SoundGroups with the same name make
InitServerthrow. - A
VluxySF_Preloadtag on a group Configuration preloads the whole group. - Presets run on an unparented
Sound. A sound the preset leaves unparented lands inUnattachedSounds. FetchPlayOncewith a name that is not in the schema warns, plays nothing, and leaves nothing behind. Before, the blank sound it returned stayed inUnattachedSoundsforever.Preload.Get()returns the templates that live inSoundService.PreloadedSounds. Preloaded sounds are built once, not twice.- Deprecated
Soundproperties such asPitch,MaxDistance,MinDistanceandEmitterSizeare no longer stored. - Warning and error messages were reworded. A definition that fails to apply warns once per failing property instead of silently stopping.
- The library table is frozen.
Added
Startup.IsPreloaded()andStartup.WaitForPreload().Conversions.FromDefinitionaccepts definitions withoutEffectsCountand skips effect entries that are notSoundEffectclasses.
Removed
- The companion VS Code extension and the generated sound-name type.
GeneratedSoundNamesis still exported and is nowstring. - The
RemoteFunctionandRateLimitinternals.
1.0.4
Last release of the 1.x line.