コード例 #1
0
        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));
        }
コード例 #2
0
 public BlobStreamAudioWrapper(IStreamAudioSource wrappedAudioSource, AudioBlob blob)
 {
     WrappedAudioSource = wrappedAudioSource;
     Blob = blob;
 }