Beispiel #1
0
        internal override IEnumerable <int> MixSamples(IFlacReader reader)
        {
            if (!reader.Read() || reader.RecordType != FlacRecordType.Subframe)
            {
                throw new FlacException("Right channel expected");
            }
            int[] left = reader.ReadSubframeValues();

            if (!reader.Read() || reader.RecordType != FlacRecordType.Subframe)
            {
                throw new FlacException("Side channel expected");
            }
            int[] side = reader.ReadSubframeValues();

            for (int i = 0; i < left.Length; i++)
            {
                yield return(left[i]);

                yield return(left[i] - side[i]);
            }

            reader.Read();
        }
Beispiel #2
0
        internal override IEnumerable <int> MixSamples(IFlacReader reader)
        {
            if (!reader.Read() || reader.RecordType != FlacRecordType.Subframe)
            {
                throw new FlacException("Mid channel expected");
            }
            int[] mid = reader.ReadSubframeValues();

            if (!reader.Read() || reader.RecordType != FlacRecordType.Subframe)
            {
                throw new FlacException("Side channel expected");
            }
            int[] side = reader.ReadSubframeValues();

            for (int i = 0; i < mid.Length; i++)
            {
                int right = mid[i] - (side[i] >> 1);
                yield return(right + side[i]);

                yield return(right);
            }

            reader.Read();
        }
Beispiel #3
0
        internal override IEnumerable <int> MixSamples(IFlacReader reader)
        {
            int blockSize    = reader.BlockSize;
            int channelCount = reader.Streaminfo.ChannelsCount;

            List <int[]> channelData = new List <int[]>(channelCount);

            while (reader.Read() && reader.RecordType == FlacRecordType.Subframe)
            {
                int[] data = reader.ReadSubframeValues();
                channelData.Add(data);
            }

            for (int i = 0; i < blockSize; i++)
            {
                for (int j = 0; j < channelCount; j++)
                {
                    yield return(channelData[j][i]);
                }
            }
        }