Esempio n. 1
0
        public RawStream(AudioFlags flags, int rate, bool disposeStream, Stream stream)
        {
            _is16Bit       = flags.HasFlag(AudioFlags.Is16Bits);
            _isLE          = flags.HasFlag(AudioFlags.LittleEndian);
            _isUnsigned    = flags.HasFlag(AudioFlags.Unsigned);
            _rate          = rate;
            _isStereo      = flags.HasFlag(AudioFlags.Stereo);
            _playtime      = new Timestamp(0, rate);
            _stream        = stream;
            _disposeStream = disposeStream;

            // Setup our buffer for readBuffer
            _buffer = new byte[SampleBufferLength * (_is16Bit ? 2 : 1)];

            // Calculate the total playtime of the stream
            _playtime = new Timestamp(0, (int)_stream.Length / (_isStereo ? 2 : 1) / (_is16Bit ? 2 : 1), rate);
        }
Esempio n. 2
0
        public RawStream(AudioFlags flags, int rate, bool disposeStream, Stream stream)
        {
            _is16Bit = flags.HasFlag(AudioFlags.Is16Bits);
            _isLE = flags.HasFlag(AudioFlags.LittleEndian);
            _isUnsigned = flags.HasFlag(AudioFlags.Unsigned);
            _rate = rate;
            _isStereo = flags.HasFlag(AudioFlags.Stereo);
            _playtime = new Timestamp(0, rate);
            _stream = stream;
            _disposeStream = disposeStream;

            // Setup our buffer for readBuffer
            _buffer = new byte[SampleBufferLength * (_is16Bit ? 2 : 1)];

            // Calculate the total playtime of the stream
            _playtime = new Timestamp(0, (int)_stream.Length / (_isStereo ? 2 : 1) / (_is16Bit ? 2 : 1), rate);
        }