Esempio n. 1
0
        internal ChdStream(IFlacDecoder flacDecoder, ILzmaDecoder lzmaDecoder, Stream baseStream)
        {
            _reader = new BinaryReader(baseStream);

            if (new string(_reader.ReadChars(8)) != "MComprHD")
            {
                throw new RhythmCodexException("Bad CHD header");
            }

            var headerLength = _reader.ReadUInt32S();
            var version      = _reader.ReadUInt32S();

            switch (version)
            {
            case 1:
                _header   = ReadHeaderV1();
                _map      = ReadMapV1();
                _readHunk = ReadHunkV1;
                break;

            case 2:
                _header   = ReadHeaderV2();
                _map      = ReadMapV1();
                _readHunk = ReadHunkV1;
                break;

            case 3:
                _header   = ReadHeaderV3();
                _map      = ReadMapV3();
                _readHunk = ReadHunkV3;
                break;

            case 4:
                _header   = ReadHeaderV4();
                _map      = ReadMapV3();
                _readHunk = ReadHunkV3;
                break;

            case 5:
                _header   = ReadHeaderV5();
                _map      = ReadMapV5();
                _readHunk = ReadHunkV5;
                break;

            default:
                throw new RhythmCodexException("Unrecognized CHD version");
            }

            _flacDecoder = flacDecoder;
            _lzmaDecoder = lzmaDecoder;
            _baseStream  = baseStream;
        }
Esempio n. 2
0
        public BmsSoundLoader(
            IWavDecoder wavDecoder,
            IMp3Decoder mp3Decoder,
            IOggDecoder oggDecoder,
            IFlacDecoder flacDecoder)
        {
            _wavDecoder  = wavDecoder;
            _mp3Decoder  = mp3Decoder;
            _oggDecoder  = oggDecoder;
            _flacDecoder = flacDecoder;

            Extensions = new Dictionary <string, Func <Stream, ISound> >
            {
                { "wav", s => _wavDecoder.Decode(s) },
                { "flac", s => _flacDecoder.Decode(s) },
                { "ogg", s => _oggDecoder.Decode(s) },
                { "mp3", s => _mp3Decoder.Decode(s) }
            };
        }
Esempio n. 3
0
 internal ChdStream(IFlacDecoder flacDecoder, ILzmaDecoder lzmaDecoder, Stream baseStream, ChdStream parent)
     : this(flacDecoder, lzmaDecoder, baseStream)
 {
     _parent = parent;
 }
Esempio n. 4
0
 public ChdStreamFactory(IFlacDecoder flacDecoder, ILzmaDecoder lzmaDecoder)
 {
     _flacDecoder = flacDecoder;
     _lzmaDecoder = lzmaDecoder;
 }