public SampleChannel Get(string name) { if (string.IsNullOrEmpty(name)) { return(null); } lock (sampleCache) { SampleChannel channel = null; if (!sampleCache.TryGetValue(name, out Sample sample)) { byte[] data = store.Get(name); sample = sampleCache[name] = data == null ? null : new SampleBass(data, PendingActions, PlaybackConcurrency); } if (sample != null) { channel = new SampleChannelBass(sample, AddItemToList); RegisterItem(channel); } return(channel); } }
public SampleChannel Get(string name) { if (IsDisposed) { throw new ObjectDisposedException($"Cannot retrieve items for an already disposed {nameof(SampleStore)}"); } if (string.IsNullOrEmpty(name)) { return(null); } this.LogIfNonBackgroundThread(name); lock (sampleCache) { SampleChannel channel = null; if (!sampleCache.TryGetValue(name, out Sample sample)) { byte[] data = store.Get(name); sample = sampleCache[name] = data == null ? null : new SampleBass(data, PendingActions, PlaybackConcurrency); } if (sample != null) { channel = new SampleChannelBass(sample, AddItem); } return(channel); } }
protected override SampleChannel CreateChannel() { var channel = new SampleChannelBass(this); mixer.Add(channel); return(channel); }
public SampleChannel Get(string name) { lock (sampleCache) { Sample sample; SampleChannel channel = null; if (!sampleCache.TryGetValue(name, out sample)) { byte[] data = store.Get(name); if (data != null) { sample = sampleCache[name] = new SampleBass(data, PendingActions); } } if (sample != null) { channel = new SampleChannelBass(sample, AddItemToList); RegisterItem(channel); } return(channel); } }