Example #1
0
        public void AdpcmIsSameAfterAligningAndUnaligning()
        {
            GcAdpcmChannel channel  = GetBuilder(100).WithLoop(true, 10, 100).Build();
            GcAdpcmChannel channel2 = channel.GetCloneBuilder().WithLoopAlignment(15).Build();
            GcAdpcmChannel channel3 = channel2.GetCloneBuilder().WithLoopAlignment(0).Build();

            Assert.Same(channel.GetAdpcmAudio(), channel3.GetAdpcmAudio());
            Assert.NotSame(channel.GetAdpcmAudio(), channel2.GetAdpcmAudio());
        }
Example #2
0
        public void AdpcmIsSameAfterAligningAndRebuilding()
        {
            GcAdpcmChannel channel  = GetBuilder(100).WithLoop(true, 10, 100).WithLoopAlignment(15).Build();
            GcAdpcmChannel channel2 = channel.GetCloneBuilder().WithSamplesPerSeekTableEntry(10).Build();

            Assert.Same(channel.GetAdpcmAudio(), channel2.GetAdpcmAudio());
        }
Example #3
0
        public void AdpcmLengthIsCorrectAfterRealignment()
        {
            GcAdpcmChannel channel  = GetBuilder(100).WithLoop(true, 10, 100).WithLoopAlignment(15).Build();
            GcAdpcmChannel channel2 = channel.GetCloneBuilder().WithLoopAlignment(20).Build();

            Assert.Equal(GcAdpcmMath.SampleCountToByteCount(110), channel2.GetAdpcmAudio().Length);
        }
Example #4
0
        private bool CompareEncodingCoarse(short[] pcm)
        {
            GcAdpcmChannel adpcmA = null;
            GcAdpcmChannel adpcmB = null;

            Parallel.Invoke(
                () => adpcmA = DllA.EncodeChannel(pcm),
                () => adpcmB = DllB.EncodeChannel(pcm)
                );

            return(ArraysEqual(adpcmA.Coefs, adpcmB.Coefs) == -1 &&
                   ArraysEqual(adpcmA.GetAdpcmAudio(), adpcmB.GetAdpcmAudio()) == -1);
        }
Example #5
0
 public short[] DecodeChannel(GcAdpcmChannel channel)
 {
     return(DecodeAdpcm(channel.GetAdpcmAudio(), channel.Coefs, channel.SampleCount));
 }
Example #6
0
        public void AdpcmLengthIsCorrectAfterBuilding()
        {
            GcAdpcmChannel channel = GetBuilder(100).WithLoop(true, 10, 100).Build();

            Assert.Equal(GcAdpcmMath.SampleCountToByteCount(100), channel.GetAdpcmAudio().Length);
        }