Ejemplo n.º 1
0
        /// <summary>
        /// Process the data (Ieee Floats) by applying the DSP Effect to each sample
        /// </summary>
        /// <param name="convertInputBuffer"></param>
        /// <param name="offset"></param>
        /// <param name="count"></param>
        private void ProcessDataIeeeFloat(ByteAndFloatsConverter convertInputBuffer, int offset, int count)
        {
            int   index       = 0;
            int   sampleCount = count / (sizeof(float));
            float sampleLeft;
            float sampleRight;

            while (index < sampleCount)
            {
                sampleLeft  = convertInputBuffer.Floats[index];
                sampleRight = convertInputBuffer.Floats[index + 1];

                if (sampleRight > 1)
                {
                    sampleRight = sampleRight + 0;
                }

                // Apply the DSP effect to the samples
                ActiveDSPEffect.Sample(ref sampleLeft, ref sampleRight);

                convertInputBuffer.Floats[index]     = sampleLeft;
                convertInputBuffer.Floats[index + 1] = sampleRight;

                index += 2;
            }
        }
Ejemplo n.º 2
0
        public override int Read(byte[] buffer, int offset, int count)
        {
            int bytesRead = SourceStream.Read(buffer, offset, count);

            if (ActiveDSPEffect.Enabled)
            {
                if (SourceStream.WaveFormat.Encoding == WaveFormatEncoding.IeeeFloat)
                {
                    ByteAndFloatsConverter convertInputBuffer = new ByteAndFloatsConverter { Bytes = buffer };
                    ProcessDataIeeeFloat(convertInputBuffer, offset, bytesRead);
                }
                else
                {
                    // Do not process other types of streams
                }
            }

            return bytesRead;
        }
Ejemplo n.º 3
0
        public override int Read(byte[] buffer, int offset, int count)
        {
            int bytesRead = SourceStream.Read(buffer, offset, count);

            if (ActiveDSPEffect.Enabled)
            {
                if (SourceStream.WaveFormat.Encoding == WaveFormatEncoding.IeeeFloat)
                {
                    ByteAndFloatsConverter convertInputBuffer = new ByteAndFloatsConverter {
                        Bytes = buffer
                    };
                    ProcessDataIeeeFloat(convertInputBuffer, offset, bytesRead);
                }
                else
                {
                    // Do not process other types of streams
                }
            }

            return(bytesRead);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Process the data (Ieee Floats) by applying the DSP Effect to each sample
        /// </summary>
        /// <param name="convertInputBuffer"></param>
        /// <param name="offset"></param>
        /// <param name="count"></param>
        private void ProcessDataIeeeFloat(ByteAndFloatsConverter convertInputBuffer, int offset, int count)
        {
            int index = 0;
            int sampleCount = count / ( sizeof( float ) );
            float sampleLeft;
            float sampleRight;
            while (index < sampleCount)
            {
                sampleLeft = convertInputBuffer.Floats[index];
                sampleRight = convertInputBuffer.Floats[index+1];

                if (sampleRight > 1)
                {
                    sampleRight = sampleRight + 0;
                }

                // Apply the DSP effect to the samples
                ActiveDSPEffect.Sample(ref sampleLeft, ref sampleRight);

                convertInputBuffer.Floats[index] = sampleLeft;
                convertInputBuffer.Floats[index + 1] = sampleRight;

                index += 2;
            }
        }