Exemple #1
0
        public StreamedBufferSoundSource(SoundInstanceStreamedBuffer instance, MediaSynchronizer synchronizer, string mediaDataUrl, long startPosition, long length)
            : base(instance, NumberOfBuffers, MaxBufferSizeBytes)
        {
            mediaSynchronizer  = synchronizer;
            this.mediaDataUrl  = mediaDataUrl;
            this.startPosition = startPosition;
            this.length        = length;

            NewSources.Add(this);
        }
        //==========================================================================================

        /// <summary>
        /// This type of DynamicSoundSource is streamed from Disk and reads compressed Celt encoded data, used internally.
        /// </summary>
        /// <param name="instance">The associated SoundInstance</param>
        /// <param name="fileProvider">The file provider to read the stream from</param>
        /// <param name="soundStreamUrl">The compressed stream internal URL</param>
        /// <param name="numberOfPackets"></param>
        /// <param name="sampleRate">The sample rate of the compressed data</param>
        /// <param name="channels">The number of channels of the compressed data</param>
        /// <param name="maxCompressedSize">The maximum size of a compressed packet</param>
        public CompressedSoundSource(SoundInstance instance, IVirtualFileProvider fileProvider, string soundStreamUrl, int numberOfPackets, int sampleRate, int channels, int maxCompressedSize) :
            base(instance, NumberOfBuffers, SamplesPerBuffer * MaxChannels * sizeof(short))
        {
            looped                 = instance.IsLooping;
            this.channels          = channels;
            this.maxCompressedSize = maxCompressedSize;
            this.fileProvider      = fileProvider;
            this.soundStreamUrl    = soundStreamUrl;
            this.sampleRate        = sampleRate;
            this.numberOfPackets   = numberOfPackets;
            playRange              = new PlayRange(TimeSpan.Zero, TimeSpan.Zero);

            NewSources.Add(this);
        }