Example #1
0
        private IAudioDest GetAudioDest(string path, int finalSampleCount)
        {
            IAudioDest dest = AudioReadWrite.GetAudioDest(path, 16, 2, 44100, finalSampleCount);

            if (dest is FLACWriter)
            {
                FLACWriter w = (FLACWriter)dest;
                w.CompressionLevel = _flacCompressionLevel;
                w.Verify           = _flacVerify;
            }
            if (dest is WavPackWriter)
            {
                WavPackWriter w = (WavPackWriter)dest;
                w.CompressionMode = _wvCompressionMode;
                w.ExtraMode       = _wvExtraMode;
            }

            return(dest);
        }
        public static IAudioDest GetAudioDest(string path, int bitsPerSample, int channelCount, int sampleRate, long finalSampleCount)
        {
            IAudioDest dest;

            switch (Path.GetExtension(path).ToLower())
            {
            case ".wav":
                dest = new WAVWriter(path, bitsPerSample, channelCount, sampleRate); break;

            case ".flac":
                dest = new FLACWriter(path, bitsPerSample, channelCount, sampleRate); break;

            case ".wv":
                dest = new WavPackWriter(path, bitsPerSample, channelCount, sampleRate); break;

            default:
                throw new Exception("Unsupported audio type.");
            }
            dest.FinalSampleCount = finalSampleCount;
            return(dest);
        }