Ejemplo n.º 1
0
        public GcAdpcmChannelBuilder GetCloneBuilder()
        {
            var builder = new GcAdpcmChannelBuilder(Adpcm, Coefs, UnalignedSampleCount)
            {
                Pcm                   = Pcm,
                Gain                  = Gain,
                StartContext          = StartContext,
                LoopAlignmentMultiple = AlignmentMultiple
            };

            builder.WithPrevious(SeekTable, LoopContextEx, Alignment);

            if (SeekTable != null)
            {
                builder.WithSeekTable(SeekTable.SeekTable, SeekTable.SamplesPerEntry, SeekTable.IsSelfCalculated);
            }

            if (LoopContextEx != null)
            {
                builder.WithLoopContext(LoopContextEx.LoopStart, StartContext.PredScale, StartContext.Hist1, StartContext.Hist2);
            }

            if (Alignment != null)
            {
                builder.WithLoop(true, Alignment.LoopStart, Alignment.LoopEnd);
            }

            return(builder);
        }
Ejemplo n.º 2
0
        internal GcAdpcmChannel(GcAdpcmChannelBuilder b)
        {
            if (b.AlignedAdpcm.Length < GcAdpcmMath.SampleCountToByteCount(b.SampleCount))
            {
                throw new ArgumentException("Audio array length is too short for the specified number of samples.");
            }

            UnalignedSampleCount = b.SampleCount;
            Adpcm = b.Adpcm;
            Pcm   = b.Pcm;

            Coefs        = b.Coefs;
            Gain         = b.Gain;
            StartContext = new GcAdpcmContext(Adpcm[0], b.StartContext.Hist1, b.StartContext.Hist2);

            Alignment     = b.GetAlignment();
            LoopContextEx = b.GetLoopContext();
            SeekTable     = b.GetSeekTable();

            //Grab the PCM data in case it was generated for the loop context or seek table
            if (!AlignmentNeeded)
            {
                Pcm = b.AlignedPcm;
            }
        }