forked from MoonsideGames/MoonWorks
rename SoundQueue to SoundSequence
parent
83f1cc24db
commit
e73c7ede55
|
@ -30,7 +30,7 @@ namespace MoonWorks.Audio
|
||||||
private readonly HashSet<WeakReference> resources = new HashSet<WeakReference>();
|
private readonly HashSet<WeakReference> resources = new HashSet<WeakReference>();
|
||||||
private readonly List<StreamingSound> autoUpdateStreamingSoundReferences = new List<StreamingSound>();
|
private readonly List<StreamingSound> autoUpdateStreamingSoundReferences = new List<StreamingSound>();
|
||||||
private readonly List<StaticSoundInstance> autoFreeStaticSoundInstanceReferences = new List<StaticSoundInstance>();
|
private readonly List<StaticSoundInstance> autoFreeStaticSoundInstanceReferences = new List<StaticSoundInstance>();
|
||||||
private readonly List<WeakReference<SoundQueue>> soundQueueReferences = new List<WeakReference<SoundQueue>>();
|
private readonly List<WeakReference<SoundSequence>> soundSequenceReferences = new List<WeakReference<SoundSequence>>();
|
||||||
|
|
||||||
private AudioTweenManager AudioTweenManager;
|
private AudioTweenManager AudioTweenManager;
|
||||||
|
|
||||||
|
@ -185,15 +185,15 @@ namespace MoonWorks.Audio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = soundQueueReferences.Count - 1; i >= 0; i -= 1)
|
for (var i = soundSequenceReferences.Count - 1; i >= 0; i -= 1)
|
||||||
{
|
{
|
||||||
if (soundQueueReferences[i].TryGetTarget(out var soundQueue))
|
if (soundSequenceReferences[i].TryGetTarget(out var soundSequence))
|
||||||
{
|
{
|
||||||
soundQueue.Update();
|
soundSequence.Update();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
soundQueueReferences.RemoveAt(i);
|
soundSequenceReferences.RemoveAt(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,9 +269,9 @@ namespace MoonWorks.Audio
|
||||||
autoFreeStaticSoundInstanceReferences.Add(instance);
|
autoFreeStaticSoundInstanceReferences.Add(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void AddSoundQueueReference(SoundQueue queue)
|
internal void AddSoundSequenceReference(SoundSequence sequence)
|
||||||
{
|
{
|
||||||
soundQueueReferences.Add(new WeakReference<SoundQueue>(queue));
|
soundSequenceReferences.Add(new WeakReference<SoundSequence>(sequence));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
protected virtual void Dispose(bool disposing)
|
||||||
|
|
|
@ -2,8 +2,8 @@ using System;
|
||||||
|
|
||||||
namespace MoonWorks.Audio
|
namespace MoonWorks.Audio
|
||||||
{
|
{
|
||||||
// NOTE: all sounds played with a SoundQueue must have the same audio format!
|
// NOTE: all sounds played with a SoundSequence must have the same audio format!
|
||||||
public class SoundQueue : SoundInstance
|
public class SoundSequence : SoundInstance
|
||||||
{
|
{
|
||||||
public int NeedSoundThreshold = 0;
|
public int NeedSoundThreshold = 0;
|
||||||
public delegate void OnSoundNeededFunc();
|
public delegate void OnSoundNeededFunc();
|
||||||
|
@ -11,14 +11,14 @@ namespace MoonWorks.Audio
|
||||||
|
|
||||||
private object StateLock = new object();
|
private object StateLock = new object();
|
||||||
|
|
||||||
public SoundQueue(AudioDevice device, ushort formatTag, ushort bitsPerSample, ushort blockAlign, ushort channels, uint samplesPerSecond) : base(device, formatTag, bitsPerSample, blockAlign, channels, samplesPerSecond)
|
public SoundSequence(AudioDevice device, ushort formatTag, ushort bitsPerSample, ushort blockAlign, ushort channels, uint samplesPerSecond) : base(device, formatTag, bitsPerSample, blockAlign, channels, samplesPerSecond)
|
||||||
{
|
{
|
||||||
device.AddSoundQueueReference(this);
|
device.AddSoundSequenceReference(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SoundQueue(AudioDevice device, StaticSound templateSound) : base(device, templateSound.FormatTag, templateSound.BitsPerSample, templateSound.BlockAlign, templateSound.Channels, templateSound.SamplesPerSecond)
|
public SoundSequence(AudioDevice device, StaticSound templateSound) : base(device, templateSound.FormatTag, templateSound.BitsPerSample, templateSound.BlockAlign, templateSound.Channels, templateSound.SamplesPerSecond)
|
||||||
{
|
{
|
||||||
device.AddSoundQueueReference(this);
|
device.AddSoundSequenceReference(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
|
|
Loading…
Reference in New Issue