public ISound Decode(BeatmaniaPs2Bgm bgm)
        {
            var output = _vagDecoder.Decode(bgm.Data);

            output[NumericData.Rate]         = bgm.Rate;
            output[NumericData.Channel]      = bgm.Channels;
            output[NumericData.SourceVolume] = bgm.Volume;
            output[NumericData.Volume]       = _beatmaniaDspTranslator.GetLinearVolume(bgm.Volume);
            output[NumericData.Panning]      = BigRational.OneHalf;
            return(output);
        }
示例#2
0
        public ISound Decode(BeatmaniaPs2Keysound keysound)
        {
            var samples   = keysound.Data.SelectMany(d => _vagDecoder.Decode(d).Samples).ToList();
            var leftRate  = keysound.FrequencyLeft == 0 ? null : (int?)keysound.FrequencyLeft;
            var rightRate = keysound.FrequencyRight == 0 ? null : (int?)keysound.FrequencyRight;
            var left      = true;

            foreach (var sample in samples)
            {
                sample[NumericData.Rate] = left ? leftRate : rightRate;
                left = !left;
            }

            return(new Sound
            {
                Samples = samples,
                [NumericData.Volume] = _beatmaniaDspTranslator.GetLinearVolume(keysound.Volume),
                [NumericData.SourceVolume] = keysound.Volume,
                [NumericData.Panning] = _beatmaniaDspTranslator.GetBm2dxPanning(keysound.Panning),
                [NumericData.SourcePanning] = keysound.Panning,
                [NumericData.Channel] = keysound.Channel
            });
        }