internal static WaveSampleMixer CreateWaveSampleMixer(SoundChannelAssignment[] assignments)
        {
            if (assignments.Length < 2 ||
                (assignments[0] == SoundChannelAssignment.Left && assignments[1] == SoundChannelAssignment.Right))
                return new AsIsWaveSampleMixer();
            else if(assignments.Length == 2)
            {
                if (assignments[0] == SoundChannelAssignment.Difference && assignments[1] == SoundChannelAssignment.Right)
                    return new RightSideWaveSampleMixer();
                else if (assignments[0] == SoundChannelAssignment.Left && assignments[1] == SoundChannelAssignment.Difference)
                    return new LeftSideWaveSampleMixer();
                else if (assignments[0] == SoundChannelAssignment.Average && assignments[1] == SoundChannelAssignment.Difference)
                    return new AverageWaveSampleMixer();
            }

            throw new NotSupportedException();
        }
Esempio n. 2
0
        public FlacMethodAndDataPair FindBestMethod(int[] channelSamples, SoundChannelAssignment channelAssigment)
        {
            if (channelSamples == null)
            {
                throw new ArgumentNullException("channelSamples");
            }
            if (channelSamples.Length == 0)
            {
                throw new ArgumentException("channelSamples has to have at least one item");
            }

            int channelBitsPerSample = Streaminfo.BitsPerSample;

            if (channelAssigment == SoundChannelAssignment.Difference)
            {
                channelBitsPerSample++;
            }

            return(new FlacMethodAndDataPair(
                       estimator.FindBestMethod(channelSamples, channelBitsPerSample),
                       channelBitsPerSample, channelSamples));
        }
Esempio n. 3
0
        public FlacMethodAndDataPair FindBestMethod(int[] channelSamples, SoundChannelAssignment channelAssigment)
        {
            if (channelSamples == null) throw new ArgumentNullException("channelSamples");
            if (channelSamples.Length == 0) throw new ArgumentException("channelSamples has to have at least one item");

            int channelBitsPerSample = Streaminfo.BitsPerSample;
            if (channelAssigment == SoundChannelAssignment.Difference)
                channelBitsPerSample++;

            return new FlacMethodAndDataPair(
                estimator.FindBestMethod(channelSamples, channelBitsPerSample),
                channelBitsPerSample, channelSamples);
        }