42 lines
956 B
C#
42 lines
956 B
C#
|
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();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|