Skip to content

Commit

Permalink
Merge pull request #854 from janholo/master
Browse files Browse the repository at this point in the history
Fixed UAudioManager Editor Bug and added Test Scene for UAudioManager
  • Loading branch information
StephenHodgson committed Aug 15, 2017
2 parents 89ca729 + e9b9c29 commit 45f122b
Show file tree
Hide file tree
Showing 17 changed files with 905 additions and 272 deletions.
573 changes: 573 additions & 0 deletions Assets/HoloToolkit-Tests/SpatialSound/Scenes/UAudioManagerTest.unity

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/HoloToolkit-Tests/SpatialSound/Scripts.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions Assets/HoloToolkit-Tests/SpatialSound/Scripts/UAudioManagerTest.cs
@@ -0,0 +1,31 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System.Collections;
using UnityEngine;

namespace HoloToolkit.Unity.Tests
{
public class UAudioManagerTest : MonoBehaviour
{
private void Start()
{
StartCoroutine(ContinouslyPlaySounds());
}

private IEnumerator ContinouslyPlaySounds()
{
while (true)
{
UAudioManager.Instance.PlayEvent("Laser");

yield return new WaitForSeconds(1.0f);

UAudioManager.Instance.PlayEvent("Vocals");

yield return new WaitForSeconds(10.0f);
}
}

}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -67,19 +67,19 @@ public string MessageOnAudioEnd
private set;
}

public AudioEvent audioEvent = null;
public bool isStoppable = true;
public float volDest = 1;
public float altVolDest = 1;
public float currentFade = 0;
public bool playingAlt = false;
public bool isActiveTimeComplete = false;
public float activeTime = 0;
public bool cancelEvent = false;
public AudioEvent AudioEvent = null;
public bool IsStoppable = true;
public float VolDest = 1;
public float AltVolDest = 1;
public float CurrentFade = 0;
public bool PlayingAlt = false;
public bool IsActiveTimeComplete = false;
public float ActiveTime = 0;
public bool CancelEvent = false;

public ActiveEvent(AudioEvent audioEvent, GameObject emitter, AudioSource primarySource, AudioSource secondarySource, string messageOnAudioEnd = null)
{
this.audioEvent = audioEvent;
this.AudioEvent = audioEvent;
AudioEmitter = emitter;
PrimarySource = primarySource;
SecondarySource = secondarySource;
Expand All @@ -103,7 +103,7 @@ private void SetSourceProperties()
}
};

AudioEvent audioEvent = this.audioEvent;
AudioEvent audioEvent = this.AudioEvent;
switch (audioEvent.Spatialization)
{
case SpatialPositioningType.TwoD:
Expand Down Expand Up @@ -165,9 +165,9 @@ private void SetSourceProperties()
});
}

if (audioEvent.Bus != null)
if (audioEvent.AudioBus != null)
{
forEachSource((source) => source.outputAudioMixerGroup = audioEvent.Bus);
forEachSource((source) => source.outputAudioMixerGroup = audioEvent.AudioBus);
}

float pitch = 1f;
Expand All @@ -186,7 +186,7 @@ private void SetSourceProperties()
if (audioEvent.FadeInTime > 0)
{
forEachSource((source) => source.volume = 0f);
this.currentFade = audioEvent.FadeInTime;
this.CurrentFade = audioEvent.FadeInTime;
if (audioEvent.VolumeRandomization != 0)
{
vol = UnityEngine.Random.Range(audioEvent.VolumeCenter - audioEvent.VolumeRandomization, audioEvent.VolumeCenter + audioEvent.VolumeRandomization);
Expand All @@ -195,7 +195,7 @@ private void SetSourceProperties()
{
vol = audioEvent.VolumeCenter;
}
this.volDest = vol;
this.VolDest = vol;
}
else
{
Expand Down
Expand Up @@ -11,10 +11,10 @@ namespace HoloToolkit.Unity
[Serializable]
public class UAudioClip
{
public UnityEngine.AudioClip sound = null;
public bool looping = false;
public UnityEngine.AudioClip Sound = null;
public bool Looping = false;

public float delayCenter = 0;
public float delayRandomization = 0;
public float DelayCenter = 0;
public float DelayRandomization = 0;
}
}
Expand Up @@ -14,12 +14,12 @@ namespace HoloToolkit.Unity
public class AudioContainer
{
[Tooltip("The type of the audio container.")]
public AudioContainerType containerType = AudioContainerType.Random;
public AudioContainerType ContainerType = AudioContainerType.Random;

public bool looping = false;
public float loopTime = 0;
public UAudioClip[] sounds = null;
public float crossfadeTime = 0f;
public int currentClip = 0;
public bool Looping = false;
public float LoopTime = 0;
public UAudioClip[] Sounds = null;
public float CrossfadeTime = 0f;
public int CurrentClip = 0;
}
}
Expand Up @@ -94,7 +94,7 @@ public class AudioEvent : IComparable, IComparable<AudioEvent>
public float UnityGainDistance = SpatialSoundSettings.DefaultUnityGainDistance;

[Tooltip("The AudioMixerGroup to use when playing.")]
public AudioMixerGroup Bus;
public AudioMixerGroup AudioBus;

[Tooltip("The default or center pitch around which randomization can be done.")]
[Range(-3.0f, 3.0f)]
Expand Down Expand Up @@ -158,8 +158,8 @@ public class AudioEvent : IComparable, IComparable<AudioEvent>
/// <returns>True if this AudioEvent's container is one of the continuous types (random or sequential), otherwise false.</returns>
public bool IsContinuous()
{
return Container.containerType == AudioContainerType.ContinuousRandom ||
Container.containerType == AudioContainerType.ContinuousSequence;
return Container.ContainerType == AudioContainerType.ContinuousRandom ||
Container.ContainerType == AudioContainerType.ContinuousSequence;
}

/// <summary>
Expand Down

0 comments on commit 45f122b

Please sign in to comment.