Skip to content

Commit 45f122b

Browse files
Merge pull request #854 from janholo/master
Fixed UAudioManager Editor Bug and added Test Scene for UAudioManager
2 parents 89ca729 + e9b9c29 commit 45f122b

17 files changed

+905
-272
lines changed

Assets/HoloToolkit-Tests/SpatialSound/Scenes/UAudioManagerTest.unity

Lines changed: 573 additions & 0 deletions
Large diffs are not rendered by default.

Assets/HoloToolkit-Tests/SpatialSound/Scenes/UAudioManagerTest.unity.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/HoloToolkit-Tests/SpatialSound/Scripts.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See LICENSE in the project root for license information.
3+
4+
using System.Collections;
5+
using UnityEngine;
6+
7+
namespace HoloToolkit.Unity.Tests
8+
{
9+
public class UAudioManagerTest : MonoBehaviour
10+
{
11+
private void Start()
12+
{
13+
StartCoroutine(ContinouslyPlaySounds());
14+
}
15+
16+
private IEnumerator ContinouslyPlaySounds()
17+
{
18+
while (true)
19+
{
20+
UAudioManager.Instance.PlayEvent("Laser");
21+
22+
yield return new WaitForSeconds(1.0f);
23+
24+
UAudioManager.Instance.PlayEvent("Vocals");
25+
26+
yield return new WaitForSeconds(10.0f);
27+
}
28+
}
29+
30+
}
31+
}

Assets/HoloToolkit-Tests/SpatialSound/Scripts/UAudioManagerTest.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/HoloToolkit/SpatialSound/Scripts/UAudioManager/ActiveEvent.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,19 @@ public string MessageOnAudioEnd
6767
private set;
6868
}
6969

70-
public AudioEvent audioEvent = null;
71-
public bool isStoppable = true;
72-
public float volDest = 1;
73-
public float altVolDest = 1;
74-
public float currentFade = 0;
75-
public bool playingAlt = false;
76-
public bool isActiveTimeComplete = false;
77-
public float activeTime = 0;
78-
public bool cancelEvent = false;
70+
public AudioEvent AudioEvent = null;
71+
public bool IsStoppable = true;
72+
public float VolDest = 1;
73+
public float AltVolDest = 1;
74+
public float CurrentFade = 0;
75+
public bool PlayingAlt = false;
76+
public bool IsActiveTimeComplete = false;
77+
public float ActiveTime = 0;
78+
public bool CancelEvent = false;
7979

8080
public ActiveEvent(AudioEvent audioEvent, GameObject emitter, AudioSource primarySource, AudioSource secondarySource, string messageOnAudioEnd = null)
8181
{
82-
this.audioEvent = audioEvent;
82+
this.AudioEvent = audioEvent;
8383
AudioEmitter = emitter;
8484
PrimarySource = primarySource;
8585
SecondarySource = secondarySource;
@@ -103,7 +103,7 @@ private void SetSourceProperties()
103103
}
104104
};
105105

106-
AudioEvent audioEvent = this.audioEvent;
106+
AudioEvent audioEvent = this.AudioEvent;
107107
switch (audioEvent.Spatialization)
108108
{
109109
case SpatialPositioningType.TwoD:
@@ -165,9 +165,9 @@ private void SetSourceProperties()
165165
});
166166
}
167167

168-
if (audioEvent.Bus != null)
168+
if (audioEvent.AudioBus != null)
169169
{
170-
forEachSource((source) => source.outputAudioMixerGroup = audioEvent.Bus);
170+
forEachSource((source) => source.outputAudioMixerGroup = audioEvent.AudioBus);
171171
}
172172

173173
float pitch = 1f;
@@ -186,7 +186,7 @@ private void SetSourceProperties()
186186
if (audioEvent.FadeInTime > 0)
187187
{
188188
forEachSource((source) => source.volume = 0f);
189-
this.currentFade = audioEvent.FadeInTime;
189+
this.CurrentFade = audioEvent.FadeInTime;
190190
if (audioEvent.VolumeRandomization != 0)
191191
{
192192
vol = UnityEngine.Random.Range(audioEvent.VolumeCenter - audioEvent.VolumeRandomization, audioEvent.VolumeCenter + audioEvent.VolumeRandomization);
@@ -195,7 +195,7 @@ private void SetSourceProperties()
195195
{
196196
vol = audioEvent.VolumeCenter;
197197
}
198-
this.volDest = vol;
198+
this.VolDest = vol;
199199
}
200200
else
201201
{

Assets/HoloToolkit/SpatialSound/Scripts/UAudioManager/AudioClip.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ namespace HoloToolkit.Unity
1111
[Serializable]
1212
public class UAudioClip
1313
{
14-
public UnityEngine.AudioClip sound = null;
15-
public bool looping = false;
14+
public UnityEngine.AudioClip Sound = null;
15+
public bool Looping = false;
1616

17-
public float delayCenter = 0;
18-
public float delayRandomization = 0;
17+
public float DelayCenter = 0;
18+
public float DelayRandomization = 0;
1919
}
2020
}

Assets/HoloToolkit/SpatialSound/Scripts/UAudioManager/AudioContainer.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ namespace HoloToolkit.Unity
1414
public class AudioContainer
1515
{
1616
[Tooltip("The type of the audio container.")]
17-
public AudioContainerType containerType = AudioContainerType.Random;
17+
public AudioContainerType ContainerType = AudioContainerType.Random;
1818

19-
public bool looping = false;
20-
public float loopTime = 0;
21-
public UAudioClip[] sounds = null;
22-
public float crossfadeTime = 0f;
23-
public int currentClip = 0;
19+
public bool Looping = false;
20+
public float LoopTime = 0;
21+
public UAudioClip[] Sounds = null;
22+
public float CrossfadeTime = 0f;
23+
public int CurrentClip = 0;
2424
}
2525
}

Assets/HoloToolkit/SpatialSound/Scripts/UAudioManager/AudioEvent.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public class AudioEvent : IComparable, IComparable<AudioEvent>
9494
public float UnityGainDistance = SpatialSoundSettings.DefaultUnityGainDistance;
9595

9696
[Tooltip("The AudioMixerGroup to use when playing.")]
97-
public AudioMixerGroup Bus;
97+
public AudioMixerGroup AudioBus;
9898

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

165165
/// <summary>

0 commit comments

Comments
 (0)