Example #1
0
        internal unsafe void __MarshalFrom(ref WaveFormatAdpcm.__Native @ref)
        {
            base.__MarshalFrom(ref @ref.waveFormat);
            this.SamplesPerBlock = @ref.samplesPerBlock;
            this.Coefficients1   = new short[(int)@ref.numberOfCoefficients];
            this.Coefficients2   = new short[(int)@ref.numberOfCoefficients];
            if ((int)@ref.numberOfCoefficients > 7)
            {
                throw new InvalidOperationException("Unable to read Adpcm format. Too may coefficients (max 7)");
                fixed(short *numPtr = & @ref.coefficients)
                {
                    for (int index = 0; index < (int)@ref.numberOfCoefficients; ++index)
                    {
                        this.Coefficients1[index] = numPtr[index * 2];
                        this.Coefficients2[index] = numPtr[index * 2 + 1];
                    }
                }

                this.extraSize = (short)(4 + 4 * (int)@ref.numberOfCoefficients);
        }
Example #2
0
 private unsafe void __MarshalTo(ref WaveFormatAdpcm.__Native @ref)
 {
     if (this.Coefficients1.Length > 7)
         throw new InvalidOperationException("Unable to encode Adpcm format. Too may coefficients (max 7)"); }