Ryuclaw.Mac/Ryuclaw.Audio.Desktop/AudioCache.cs

42 lines
956 B
C#
Raw Normal View History

2023-08-28 16:38:06 +00:00
using System;
using System.Collections.Generic;
using Ryuclaw.Shared.Audio;
using Ryuclaw.Audio.Shared;
namespace Ryuclaw.Audio.Desktop
{
public class AudioCache : IAudioCache
{
private Dictionary<string, WaveReader> _cache;
public AudioCache()
{
_cache = new();
}
public WaveReader Get(string name)
{
if (_cache.TryGetValue(name, out var reader))
{
return reader;
} else
{
var newReader = new WaveReader();
newReader.Load(name);
_cache[name] = newReader;
return newReader;
}
}
public void Set(string name, IAudioSource source)
{
throw new NotImplementedException();
}
IAudioSource IAudioCache.Get(string name)
{
throw new NotImplementedException();
}
}
}