Ejemplo n.º 1
0
//		private void FillBuffers()
//		{
//			this._CurrentWriteBuffer = this._RootBuffer;
//
//			do
//			{
//				FillBuffer( _CurrentWriteBuffer );
//
//				_CurrentWriteBuffer = _CurrentWriteBuffer.NextBuffer;
//
//			} while( _CurrentWriteBuffer != _RootBuffer );
//		}
//

        private void FillBuffer(object sender, WaveBufferEmptyEventArgs args)
        {
            // Fill the buffer
            this._BufferEmptyHandler(this, args);

            // TODO:  Examine args.BytesWritten to determine when end of data reached.
            if (args.BytesWritten <= 0)
            {
                // TODO:  Take action to signal playing should stop.
                this._IsPlaying = false;
            }
//
//			// Signal the buffer that it has data.
//			buffer.BufferFilled();
        }
Ejemplo n.º 2
0
        internal void FillBuffer(WaveOutBuffer buffer)
        {
#if DEBUG
            this._FillCount++;
#endif
            WaveBufferEmptyEventArgs args = new WaveBufferEmptyEventArgs(buffer.Data, buffer.Length);

            _FillerDelegate(buffer, args);

            // Stop playing if we no longer have data.
            if (args.BytesWritten == 0)
            {
                Stop();
            }
        }
Ejemplo n.º 3
0
        private void FillBufferHandler(object sender, WaveBufferEmptyEventArgs args)
        {
            byte[] buffer = new byte[args.Length];

            int length = _BaseStream.Read(buffer, 0, args.Length);

            for (int i = length; i < args.Length; i++)
            {
                buffer[i] = 0;
            }

            if (length <= 0)
            {
                _Player.Stop();
            }

            args.BytesWritten = length;

            Marshal.Copy(buffer, 0, args.Buffer, length);
        }
Ejemplo n.º 4
0
        private void BufferFiller(object sender, WaveBufferEmptyEventArgs args)
        {
            lock (_StreamBuffer)
            {
                args.BytesWritten = _Reader.Read(_StreamBuffer, 0, args.Length);

                //				int index = 0;
                //				int length = args.Length;
                //
                //				while( index < length && _DataStream.Length != _DataStream.Position )
                //					_StreamBuffer[index++] = _Reader.ReadByte();
                //
                //				args.BytesWritten = length;
                //
                for (int i = args.BytesWritten, length = args.Length; i < length; i++)
                {
                    _StreamBuffer[i] = 0;
                }

                Marshal.Copy(_StreamBuffer, 0, args.Buffer, args.Length);
            }
        }