Exemplo n.º 1
0
        private void WriteData(BinaryWriter writer)
        {
            byte[][] audio = Adpcm.Channels.Select(x => x.Audio).ToArray();

            if (Configuration.EncryptionKey != null)
            {
                // Don't encrypt the original audio
                audio = audio.Select(x => x.ToArray()).ToArray();
                CriAdxEncryption.EncryptDecrypt(audio, Configuration.EncryptionKey, Configuration.EncryptionType, FrameSize);
            }

            audio.Interleave(writer.BaseStream, FrameSize, FrameCount * FrameSize);
        }
Exemplo n.º 2
0
        protected override IAudioFormat ToAudioStream(AdxStructure structure)
        {
            if (structure.EncryptionKey != null)
            {
                CriAdxEncryption.EncryptDecrypt(structure.AudioData, structure.EncryptionKey, structure.Revision, structure.FrameSize);
            }

            var channels = new CriAdxChannel[structure.ChannelCount];

            for (int i = 0; i < structure.ChannelCount; i++)
            {
                channels[i] = new CriAdxChannel(structure.AudioData[i], structure.HistorySamples[i][0], structure.Version);
            }

            return(new CriAdxFormatBuilder(channels, structure.SampleCount - structure.InsertedSamples, structure.SampleRate, structure.FrameSize, structure.HighpassFreq)
                   .WithLoop(structure.Looping, structure.LoopStartSample - structure.InsertedSamples, structure.LoopEndSample - structure.InsertedSamples)
                   .WithAlignmentSamples(structure.InsertedSamples)
                   .WithEncodingType(structure.EncodingType)
                   .Build());
        }