Example #1
0
 internal GcAdpcmChannelBuilder WithPrevious(GcAdpcmSeekTable seekTable, GcAdpcmLoopContext loopContext, GcAdpcmAlignment alignment)
 {
     PreviousSeekTable   = seekTable;
     PreviousLoopContext = loopContext;
     PreviousAlignment   = alignment;
     return(this);
 }
Example #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;
            }
        }
Example #3
0
        internal GcAdpcmAlignment GetAlignment()
        {
            if (PreviousAlignmentIsValid())
            {
                return(PreviousAlignment);
            }
            var alignment = new GcAdpcmAlignment(LoopAlignmentMultiple, LoopStart, LoopEnd, Adpcm, Coefs);

            if (alignment.AlignmentNeeded)
            {
                AlignedAdpcm     = alignment.AdpcmAligned;
                AlignedPcm       = alignment.PcmAligned;
                AlignedLoopStart = alignment.LoopStart;
            }

            return(alignment);
        }