July 2017
Beginner to intermediate
390 pages
10h 53m
English
In the Content folder, next to SpinningCubeRenderer, we will add our VoicePlayer class:
using System;
namespace VoiceInHolographicDirectX.Content
{
internal class VoicePlayer : IDisposable
{
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
~VoicePlayer()
{
Dispose(false);
}
protected virtual void Dispose(bool isDisposing)
{
if (isDisposing)
{
// Here we will dispose our voice parts
}
}
}
}
As you can see, I have added the IDispose interface and implemented the dispose pattern. Since we will be using many resources that need to be cleaned up, I thought I would show you how this is done just the once.
Because the code in our VoicePlayer will be an almost exact copy of the SoundPlayer ...
Read now
Unlock full access