Closed Okabintaro closed 1 month ago
I have not tested any of the following, it's up to you to choose if you want to give it a shot or not:
You can try installing the Developer Only VPM listing https://hai-vr.github.io/vpm-listing-developeronly/
Then, in VCC/ALCOM, enable pre-releases packages, and install 1.0.9941-alpha.1
If VCC still has the bug that prevents multiple listings from referencing the same package, then temporarily disable the regular VPM listing.
Usage:
.NewState("Example")
.Audio(source, audio =>
{
// Get the PlayAudio object if there's a need to edit it directly.
VRCAnimatorPlayAudio vrcAnimatorPlayAudio = audio.PlayAudio;
// By default, a PlayAudio created through AAC does nothing (unlike a manually created behaviour)
// so you need to invoke anything that is relevant.
audio
.SelectsClip(VRC_AnimatorPlayAudio.Order.Random, clips)
.SetsLooping()
.RandomizesPitch(0.8f, 1.2f)
.RandomizesVolume(0.5f, 1f)
.StartsPlayingOnEnter()
.StopsPlayingOnExit();
});
Notes:
The Stop and Play checkboxes are grouped into three semantic functions.
You can only invoke one of the following:
ReplaysOnEnter
stops and starts the audio.StartsPlayingOnEnter
starts the audio only, it doesn't stop it.StopsPlayingOnEnter
stops the audio, and doesn't start it.All of the three above functions affect both the Stop and Play checkboxes at once.
If you want to do neither starting nor stopping the audio, then don't invoke any of those three functions.
By default, all invocations of Audio
will empty the Animator Play Audio component at the beginning so that it does nothing.
A limitation of the current draft is that AAC will not allow 2 or more Animator Play Audio on the same state, which can be an issue, so I may later implement NewAudio(
, as well as NewDriver(
that follows a similar pattern (as Drivers have become more complex over time).
Wow, thanks for the fast implementation. I will try it out later tonight and report back.
My use case is playing a single set of randomized clips on state enter so this should suffice.
Thanks, it seems to work just fine. Looking at the generated state though, for some reason it seems to create two identical state behaviours:
Not sure if that's a problem or just an artifact/bug of Av3Emulator
AFAIK this is an artifact of Play mode, I don't know more than that
Feature is being staged for V1.1.0
Released in 2f82700a945abf0c474923182bd9ba8888f7b9a2
Would be cool if you could use the newly introduced Play Audio State Behaviour in AaC: https://creators.vrchat.com/avatars/state-behaviors/#animator-play-audio