Skip to content

Commit

Permalink
fix: quest audio sawce :3
Browse files Browse the repository at this point in the history
@Naraenda watr car creatura
  • Loading branch information
DeltaNeverUsed authored Nov 2, 2024
1 parent b168f88 commit b5e9357
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions Packages/befuddledlabs.opensyncdance/Runtime/OpenSyncDance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ private void GenerateSendLayer()
var exitMusicState = _sendLayer.NewState($"Exit Music {currentSyncedAnimation.name}");

// Set the audio clip on the audio source
if (currentSyncedAnimation.entry.audio.audioClip)
if (currentSyncedAnimation.entry.audio.audioClip && _audioSource)
{
entryMusicState.Audio(_audioSource, (a) =>
{
Expand All @@ -395,7 +395,7 @@ private void GenerateSendLayer()
});
}

if (currentSyncedAnimation.loop.audio.audioClip)
if (currentSyncedAnimation.loop.audio.audioClip && _audioSource)
{
loopMusicState.Audio(_audioSource, (a) =>
{
Expand All @@ -407,7 +407,7 @@ private void GenerateSendLayer()
});
}

if (currentSyncedAnimation.exit.audio.audioClip)
if (currentSyncedAnimation.exit.audio.audioClip && _audioSource)
{
exitMusicState.Audio(_audioSource, (a) =>
{
Expand Down Expand Up @@ -439,15 +439,17 @@ void ToggleBits(AacFlEditClip a)
entryMusicState.WithAnimation(_aac.NewClip().Animating(a =>
{
ToggleBits(a);
var volume = a.Animates(_audioSource, "m_Volume");
volume.WithUnit(AacFlUnit.Seconds, (AacFlSettingKeyframes key) =>
{
key.Linear(0.0f, 0.0f);
key.Linear(0.2f, currentSyncedAnimation.entry.audio.volume);
if (currentSyncedAnimation.entry.animationClip)
key.Linear(currentSyncedAnimation.entry.animationClip.length,
currentSyncedAnimation.entry.audio.volume);
});
if (_audioSource) {
var volume = a.Animates(_audioSource, "m_Volume");
volume.WithUnit(AacFlUnit.Seconds, (AacFlSettingKeyframes key) =>
{
key.Linear(0.0f, 0.0f);
key.Linear(0.2f, currentSyncedAnimation.entry.audio.volume);
if (currentSyncedAnimation.entry.animationClip)
key.Linear(currentSyncedAnimation.entry.animationClip.length,
currentSyncedAnimation.entry.audio.volume);
});
}
}));
loopMusicState.WithAnimation(toggleClip);
exitMusicState.WithAnimation(toggleClip);
Expand All @@ -466,6 +468,10 @@ void ToggleBits(AacFlEditClip a)

private void GenerateSoundEnableLayer()
{
// This is your center left audio channel
if (!_audioSource) // Quest pee pee poo poo
return;

var toggleLayer = _aac.CreateSupportingArbitraryControllerLayer(_animationControllerFX, "SoundToggle");
var soundParam = toggleLayer.BoolParameter("OSD_Sound");

Expand Down Expand Up @@ -501,7 +507,7 @@ private void GenerateReceiveLayer()
readyState.TransitionsTo(lockState).When(enabled.IsFalse());
lockState.TransitionsTo(readyState).When(enabled.IsTrue());

// Ugly thing to not IK sync the animation
// Ugly thing to not IK sync the animation :3
readyState.TrackingTracks(AacAv3.Av3TrackingElement.Head);
readyState.TrackingTracks(AacAv3.Av3TrackingElement.LeftHand);
readyState.TrackingTracks(AacAv3.Av3TrackingElement.RightHand);
Expand Down Expand Up @@ -927,4 +933,4 @@ public override void OnInspectorGUI()
}
}

#endif
#endif

1 comment on commit b5e9357

@Naraenda
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Please sign in to comment.