public IStreamAudioSource GetStreamAudioSource(AudioBlob blob) { if (blob.Stream == null) { Logger.LogInformation("NAudioBlobStreamAudioSourceProvider can read from streams only (is null)"); return(null); } WaveStream waveStream = null; switch (blob.Format.Type) { case StreamAudioFormatType.Wave: waveStream = new WaveFileReader(blob.Stream); break; case StreamAudioFormatType.Vorbis: waveStream = new global::NAudio.Vorbis.VorbisWaveReader(blob.Stream); break; } if (waveStream == null) { return(null); } return(new BlobStreamAudioWrapper(new NAudioWaveStreamToStreamAudioSourceAdapter(waveStream), blob)); }
public BlobStreamAudioWrapper(IStreamAudioSource wrappedAudioSource, AudioBlob blob) { WrappedAudioSource = wrappedAudioSource; Blob = blob; }